本文介绍了DbUnit.NET替代品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

还有没有其他的.NET(2.0)单元测试框架数据库访问code除了DbUnit.NET?

Are there other '.NET (2.0) Unit Testing Framework for Database Access Code' besides DbUnit.NET?

我一直在试图DbUnit.NET和不支持的某些东西。此外,该项目似乎是在阿尔法自2006年5月22日......

I've been trying DbUnit.NET and some things are not supported. Also, the project seems to be in alpha since 22nd May 2006...

我们正在重构我们的架构能够做的测试与嘲讽的框架,但直到工作完成,我想有像DbUnit.NET(但更好)的框架。

We are refactoring our architecture to be able to do tests with mocking frameworks, but until that work is done I'd like to have a framework like DbUnit.NET (but better).

推荐答案

我在几年前就遇到了这个问题。我恼火DBUnit.Net的状态。它缺少对我很重要的功能。由于 IKVM ,它不是很难使用DbUnit的正常Java版本的dotnet的。作为事实上,我跑的C#集成测试,现在正在使用原来的DBUnit的。以下是我转换DBUnit的Java版本到.NET程序集:

I ran into this problem a few years ago. I was annoyed at the state of DBUnit.Net. It was missing features that were important to me. Thanks to IKVM, it's not very difficult to use the normal Java version of DBUnit from dotnet. As a matter of fact, I'm running C# integration tests right now that are using the original DBUnit. Here's how I converted the java version of DBUnit into a .Net assembly:

  • 在下载 IKVM
  • 将以下jar文件到一个共同的目录:公地集合-3.2.jar共享记录-1.1.jar的junit-4.1.jar公郎-2.2.jar的DbUnit-2.2.jar sqljdbc.jar

现在,从一个工作普通的jar目录的目录中的命令行:

Now, from the command line with a working directory of the common jar directory:

ikvmc -target:libary -keyfile:yoursignature.snk -debug -version:2.2.0.0 -out:dbunit.dll *.jar

您可以从以下位置所需的库:

You can get necessary libraries from the following locations:

  • commons-* Apache Commons
  • dbunit.jar DbUnit homepage
  • sqljdbc.jar MSDN
  • junit.jar Junit homepage

如果您没有使用SQL Server作为您的数据库,然后用适当的JDBC驱动程序替换sqljdbc.jar。要直接从您的.NET code使用DbUnit,包括dbunit.dll及相应的IKVM组件。

If you are not using SQL Server as your database, then replace sqljdbc.jar with the appropriate JDBC driver. To use DBUnit directly from your .Net code, include dbunit.dll and the appropriate IKVM assemblies.

罐子版本在这里我已经给老。我对这个问题的笔记是近三年来的历史。新版本可能会工作,但我还没有尝试过。

The jar versions I have given here are old. My notes on this subject are almost three years old. Newer versions will probably work, but I have not tried them.

这篇关于DbUnit.NET替代品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 03:55