I am new to unit test case writing using mstest framework and I am stuck in retrieving new line character from the xml file as an input to expected value. Below is the piece of test method
public void ExtractNewLineTest()
{
MathLibraray target = new MathLibraray(); // TODO: Initialize to an appropriate value
string expected = TestContext.DataRow["ExpectedValue"].ToString(); => I am retrieving the value from the xml file.
string actual;
actual = target.ExtractNewLine();
Assert.AreEqual(expected, actual);
}
Below is the xml content
<ExtractNewLineTest>
<ExpectedValue><![CDATA[select distinct\tCDBREGNO,\r\n\tMOLWEIGHT,\r\n\tMDLNUMBER\r\nfrom Mol]]></ExpectedValue>
</ExtractNewLineTest>
When I retrieve the data from the xml to expected value, I am getting below string
ExpectedValue = “select distinct\\tCDBREGNO,\\r\\n\\tMOLWEIGHT,\\r\\n\\tMDLNUMBER\\r\\nfrom Mol”;
If we see the above value, extra slash is getting added for both \n and \r. Please let me know, how I can assert this value. Thanks!