I have file content like this
XXX,AAAAAA,B,CC;Cont 123456;2.50;1;1;1;2;0;1;l;
XXX,AAAAAA,B,CC;Avboo;1.20;1;1;1;2;0;1;l;
XXX,AAAAAA,B,CC;Dartw esata garle;3.00;1;1;1;2;0;1;ccc;
file is saved in c:\myFile.txt
in my nunit test I'm trying to create exact strings as is inside file content and after that I want to assert that are equal
[Test]
public void test()
{
string line1 = "XXX,AAAAAA,B,CC;Cont 123456;2.50;1;1;1;2;0;1;l;\r\n";
string line2 = "XXX,AAAAAA,B,CC;Avboo;1.20;1;1;1;2;0;1;l;\r\n";
string line3 = "XXX,AAAAAA,B,CC;Dartw esata garle;3.00;1;1;1;2;0;1;ccc;\r\n";
string expected = string.Concat(line1,line2,line3);
var fileContent = File.ReadAllText(@"C:\myFile.txt");
Assert.AreEqual(fileContent, expected);
}
Althout it's looks like that it should be exact strings I'm getting error
Excpected string length 149 but was 154. Strings differ at index 86
File.ReadAllText()?@char in front of your expected strings, i.e.string line1 = @"XXX...";+at the end, example: string expected = "..." + (next line) "...".