
Untitled
By: a guest on
Apr 23rd, 2012 | syntax:
None | size: 0.66 KB | hits: 29 | expires: Never
Passing single value to params argument in NUnit TestCase
[ExpectedException(typeof(ParametersParseException))]
[TestCase("param1")]
[TestCase("param1", "param2")]
[TestCase("param1", "param2", "param3", "optParam4", "optParam5", "some extra parameter")]
public void Parse_InvalidParametersNumber_ThrowsException(params string[] args)
{
new ParametersParser(args).Parse();
}
System.ArgumentException : Object of type 'System.String'
cannot be converted to type 'System.String[]'.
[TestCase(new[] { param1 })]
error CS0182: An attribute argument must be a constant expression,
typeof expression or array creation expression of an attribute parameter type