Received and Approved files are equal but diff complains
Brought to you by:
isidore_usa
When using a custom method to create a string to approve, the TortoiseMerge diff says the files are not equal even if they are. Or at least they are equal to the eye, I assume there is some minor invisible diffrence since the differ says so. See the example. I can run it many times in a row, and the test fails with that message every time.
How to fix?
The string is built using methods like this one:
public string ApprovalString()
{
return GetType().GetProperties().Aggregate(string.Format("\n\n{0}\n\n", GetType().Name), (current, prop) => current + string.Format("* {0}: {1}\n", prop.Name, prop.GetValue(this, null)));
}
Approvals.Verify(myObject.ApprovalString());
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Example
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Actually, I get the same issue with this simple test:
[Test]
[UseReporter(typeof(DiffReporter))]
public void StringTest()
{
Approvals.Verify("abc");
}
while the following test is OK:
[Test]
[UseReporter(typeof(DiffReporter))]
public void StringTest()
{
const string text = "abc";
Approvals.Verify(text);
}