MSTest has DataSourceAttribute
. By marking unit test method with it you grant your test access to, well - data source. It supports many various formats, from databases to CSV or excel files.
Example from this blog post:
[TestMethod]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV",
"MyWidgetTests.csv", "MyWidgetTests#csv", DataAccessMethod.Sequential)]
public void TestMyBusinessLogicWithCsv()
{
int valueA = Convert.ToInt32(TestContext.DataRow["valueA"]);
int valueB = Convert.ToInt32(TestContext.DataRow["valueB"]);
int expectedResult = Convert.ToInt32(TestContext.DataRow["expectedResult"]);
int actualResult = MyWidget.MyBusinessLogic(valueA, valueB);
Assert.AreEqual(expectedResult, actualResult,
"The result returned from the widget was not as expected.");
}