I would like to read values of DataRowAttribute from TestInitialize method, so common presetups could be made accrodingly.
[TestClass]
public class UnitTest1
{
public TestContext TestContext { get; set; }
[ClassInitialize]
public static void SetupTests(TestContext testContext)
{
}
[DataTestMethod]
[TestInitialize]
public void SetupTest()
{
var attrValue = TestContext.DataRow;
}
[DataTestMethod]
[DataRow(6,8)]
public void TestMethod1(int i, int y)
{
Assert.IsTrue(true);
}
}
TestContext.DataRow returns null since it's expecting DataSourceAtrribute. Sure I could switch to DataSourceAtrribute but maybe there is a better solution.