I'm writing some integration tests which should check for the reading of an existing text file. Initially, I was trying to check the results by comparing the results through strings. However, that doesn't seem to be working well. Here's an excerpt from my code:
var bytes = File.ReadAllBytes(Path.Combine(path, guid.ToString()));
Assert.Equal(bytes, docBytes); //true
Assert.Equal(File.ReadAllText(Path.Combine(path, guid.ToString())).Trim(), Encoding.UTF8.GetString(docBytes).Trim()); //false
Now, here's what the debguger window shows
I've thought about different encodings and BOM error related problems, but looking at the debugger, both strings seem to be equal (if there was some sort of encoding problem, then the characters should be different, right?). Any clues on what's going on?
Thanks.
Luis