i am writing Data driven unit tests in C#. I want to attach data source at class level so that all the test will run for set of inputs. Some how the problem is with the TestContext property which i cannot access as the ClassInitialize method is static. Below is the code -
[ClassInitialize]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV",
"TrackingData.csv",
"TrackingData#csv",
DataAccessMethod.Sequential)]
public static void ClassInit(TestContext tc)
{
// Inside this i am trying to access the static TestContext property but its not working
}
public static TestContext TestContext {get; set;}
The error which i am getting is 'you cannot have a static TestContext Property.
Could some one please help me out here?