for some test, I need to run a data driven test with the configuration that is generated (via reflection) in the ClassInitialize method (using reflection). I tried everything, but I just canβt set up the data source correctly.
The test takes a list of classes in the csv file (one line for each class), and then checks that the mappings in the database work well (i.e. try to get one element from the database for each entity, an exception if the table structure does not match )
Test method:
[DataSource( "Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\EntityMappingsTests.Types.csv", "EntityMappingsTests.Types#csv", DataAccessMethod.Sequential) ] [TestMethod()] public void TestMappings () {
Obviously, the EntityMappingsTests.Types.csv file. It must be in the DataDirectory.
Now, in the Initialize method (marked by ClassInitialize), I put this together and then try to write it.
WHERE should I write it? WHERE IS THE HISTORY OF DataDirectory?
I tried:
File.WriteAllText(context.TestDeploymentDir + "\\EntityMappingsTests.Types.csv", types.ToString()); File.WriteAllText("EntityMappingsTests.Types.csv", types.ToString());
Both results lead to the fact that "the unit test adapter could not connect to the data source or read the data." More precisely:
Error Details: The Microsoft Jet database engine could not find object 'EntityMappingsTests.Types.csv'. Make sure that the object exists and that you correctly name its name and path name.
So where should I put this file?
I also tried just writing it to the current directory and taking out the DataDirectory part - the same result. Unfortunately, there is limited debugging support here.