I know I can use data in files to drive unit test, for example data inside a csv or xml file.
For example:
[TestMethod]
[DataSource(
"Microsoft.VisualStudio.TestTools.DataSource.CSV",
"Data.csv",
"Data#csv",
DataAccessMethod.Sequential)]
public void TestData() {}
I would like to know if there is a way that, instead of using a file, I can use a data structure that's already in memory to drive the tests.
Something like:
// this structure has the data to use in the unit test
var DataList = new List<string>();
[TestMethod]
[DataSource(
"Microsoft.VisualStudio.TestTools.DataSource.IEnumerable",
"DataList",
"DataList",
DataAccessMethod.Sequential)]
public void TestData() {}