【发布时间】:2010-12-03 10:35:58
【问题描述】:
我想做这样的事情
[Test]
public void Test([Values(new DateTime(2010, 12, 01),
new DateTime(2010, 12, 03))] DateTime from,
[Values(new DateTime(2010, 12, 02),
new DateTime(2010, 12, 04))] DateTime to)
{
IList<MyObject> result = MyMethod(from, to);
Assert.AreEqual(1, result.Count);
}
但我收到以下关于参数的错误
属性参数必须是 常量表达式,typeof 表达式 或数组的创建表达式
有什么建议吗?
更新:关于 NUnit 2.5 中的参数化测试的好文章
http://www.pgs-soft.com/new-features-in-nunit-2-5-part-1-parameterized-tests.html
【问题讨论】:
标签: c# unit-testing nunit