Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 23rd, 2012  |  syntax: None  |  size: 0.66 KB  |  hits: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Passing single value to params argument in NUnit TestCase
  2. [ExpectedException(typeof(ParametersParseException))]
  3. [TestCase("param1")]
  4. [TestCase("param1", "param2")]
  5. [TestCase("param1", "param2", "param3", "optParam4", "optParam5", "some extra parameter")]
  6. public void Parse_InvalidParametersNumber_ThrowsException(params string[] args)
  7. {
  8.     new ParametersParser(args).Parse();
  9. }
  10.        
  11. System.ArgumentException : Object of type 'System.String'
  12. cannot be converted to type 'System.String[]'.
  13.        
  14. [TestCase(new[] { param1 })]
  15.        
  16. error CS0182: An attribute argument must be a constant expression,
  17. typeof expression or array creation expression of an attribute parameter type