'Unit test for two string arrays
The below data row in my unit test throws an error message when two string arrays follow after one another, but not when I place another data type in-between.
[TestClass]
public class UnitTest
{
[TestMethod]
// invalid
[DataRow(new string[] { }, new string[] { })]
// valid
[DataRow(new string[] { }, 8, new string[] { })]
public void TestMethod(string[] input, string[] output)
{
var solution = new Program();
CollectionAssert.AreEqual(output, solution.Method(input));
}
}
And I get the following error (on line 6), an attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type. I'm defining the array in constructor, so how is it not constant? Thank you in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
