I am not able to find something on the internet for the last hours. The situation is the following: I want to test a parser I have written, for this I have the desire to write a data driven unit test. The XML I have looks like the following:
<Test>
<ParseTest>
<Case>
<uri>somestring</uri>
<key>somestring</key>
<value>somestring</value>
</Case>
<Case>
<uri>somestring</uri>
<key>somestring</key>
<value>somestring</value>
</Case>
</ParseTest>
</Test>
Test is my root node for the whole class. The ParseTest should be the root for each method, so I want to access per run one case node with its childs
My testing code is:
[TestMethod]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML",@"PATH\name.xml","ParseTest",DataAccessMethod.Seqential)]
public void ParseTest()
{
//Arrange
m_testContext.DataRow["uri"].ToString();
//Act
//Assert
}
Problem with it is, that the Framework does not find the correct childnodes. The file is found correctly. I run the test via “Run test“ in VS.
Directory.GetCurrentDirectory())?