在内存数据库管理系统的单元测试 [英] In-memory DBMS's for unit testing

查看:145
本文介绍了在内存数据库管理系统的单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找满意的选择单元测试我的.NET DAL类;因为他们是DAL类,它们访问数据库直接使用ADO.NET。 presently我使用的是MSSQL数据库的测试实例,但不知道什么更快的选项有---因为单元测试需要尽可能快地运行,在内存中的解决方案将是理想的。

I am looking for satisfactory options for unit testing my .NET DAL classes; since they're DAL classes, they access the database directly using ADO.NET. Presently I use an instance of a MSSQL database for the testing, but was wondering what faster options there are---since unit tests need to run as quickly as possible, an in-memory solution would be ideal.

我还要提到的是我已经追平自己TSQL,因为我永远只能将使用微软平台。

I should also mention that I have tied myself to TSQL since I'm only ever going to be using a Microsoft platform.

推荐答案

既然你声明:

我还要提到的是我已经绑   自己TSQL因为我只有永远   将要使用微软   平台。

I should also mention that I have tied myself to TSQL since I'm only ever going to be using a Microsoft platform.

然后使用SqlServer的精简版可以很好地满足您的需求。 在存储器它不会完全操作,但可以在只读模式(其中,没有编辑发生到主数据库文件,因此它可以在一次被多个测试)操作

Then Using SqlServer compact Edition may work well for your needs. It will not operate entirely in memory but can operate in a readonly mode (where no edits occur to the main database file so it can be used by multiple tests at once)

有几个陷阱,不支持存储过程,需要翻译和某些数据类型有严格限制(特别是VARCHAR只能到4000个字符)的几个数据类型的LINQ到SQL也不是适当的支持。

There are a few gotchas, no stored procedures are supported, a few data types need to be translated and certain data types have tight limits (notably varchar which can only go to 4000 characters) Linq to Sql also is not properly supported.

不过我使用了一个SqlServer的精简版作为一个几乎完全下降代替了良好的效果正确的SQL Server数据库。

Nonetheless I have used a SqlServer Compact Edition as an almost entirely drop replacement for the proper Sql Server database with good results.

这篇关于在内存数据库管理系统的单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆