在MSTest的,你可以这样做:
In MSTest you can do something like:
[TestMethod]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV",
"testdata.csv", "testdata#csv", DataAccessMethod.Sequential)]
public void TestSomething()
{
double column1 = Convert.ToDouble(TestContext.DataRow["column1"]);
...
Assert.AreEqual(...);
}
什么是相当于code在NUnit的2.5?
What is the equivalent code in NUnit 2.5?
我会看着参数测试文档中的NUnit 2.5 ,看看你可以这样做,你在做什么存在。我不记得NUnit的有一个内置的CSV阅读属性驱动的参数测试。有可能是一个社区的插件某处虽然。
I would look at the parameterized tests documentation in NUnit 2.5 and see if you can do something like what you're doing there. I do not recall NUnit having a built-in CSV reading attribute to drive parameterized tests. There may be a community plug-in somewhere though.
我还应该指出的是,如果你只是在寻找非MS单元测试框架库,为您排忧解难,xUnit.net确实有这个功能。看看从本堂本博客帖子
I should also point out that if you are just looking for non-MS Unit Testing framework libraries to help you out, xUnit.net does have this functionality. Check out this blog post from Ben Hall