0

how could i pass an object in my unit test? here's my code:

    [Test]          
    [Row( "test",5,new CustomField())]      
    public void Test_Constructor(string type, int number, CustomField customField)
    {
       .....
    }

it returns an error: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

raberana
  • 11,739
  • 18
  • 69
  • 95

1 Answers1

2

You can use a factory:

http://gallio.org/wiki/doku.php?id=mbunit:data-driven_testing:factory

grahamrhay
  • 2,046
  • 4
  • 19
  • 29
  • that's nice but actually, my row attribute is in a format like this: [Row("string",5,new Class1()))]. I cant implement a factory in my test. – raberana Jul 05 '12 at 02:00
  • 2
    You can return an array from the factory, look at the "complex factory" example. – grahamrhay Jul 05 '12 at 08:02