In the following code, GetTestCaseData
is not able to map to ProcessFilterRecords_ReturnsData()
. The test explorer does show the yield return value but the debugger never enters ProcessFilterRecords_ReturnsData()
. If I pass string directly to JArray.Parse()
, that works.
public class SampleClass
{
private static IEnumerable<TestCaseData> GeTestCaseData
{
get
{
yield return new TestCaseData("arg1val1", JArray.Parse(JsonConvert.SerializeObject(GenerateList(4))));
yield return new TestCaseData("arg1val2", JArray.Parse(JsonConvert.SerializeObject(GenerateList(5))));
}
}
[TestCaseSource(typeof(SampleClass), "GeTestCaseData_List")]
public void ProcessFilterRecords_ReturnsData(string arg1, JArray testdata)
{
//Arrange
//Act
//Assert
Assert.IsTrue(true);
}
public static GenerateList(int n)
{
var data = new List<int>();
for(int i=0;i<n;i++)
{
data.Add(i);
}
return data;
}
}