Unit testing 在单元测试的属性中传递对象
我如何通过单元测试中的对象? 这是我的密码:Unit testing 在单元测试的属性中传递对象,unit-testing,c#-4.0,mbunit,Unit Testing,C# 4.0,Mbunit,我如何通过单元测试中的对象? 这是我的密码: [Test] [Row( "test",5,new CustomField())] public void Test_Constructor(string type, int number, CustomField customField) { ..... } 它返回一个错误:属性参数必须是常量表达式、类型表达式或属性参数类型的数组创建表达式 这很好,但实际上,我
[Test]
[Row( "test",5,new CustomField())]
public void Test_Constructor(string type, int number, CustomField customField)
{
.....
}
它返回一个错误:属性参数必须是常量表达式、类型表达式或属性参数类型的数组创建表达式
这很好,但实际上,我的行属性的格式如下:[row(“string”,5,new Class1())]。我无法在测试中实现工厂。您可以从工厂返回数组,请看“复杂工厂”示例。