I've run into an unusual problem that I haven't seem to be able to make any headway against. In one of my unit tests, I have a statement Assert.AreEqual(<property 1>, <property 2>). I have confirmed through debugging that these two values are equivalent. When I simply Run or Debug, this test succeeds. However, when I check for code coverage, the test fails. I'm using dotCover 2.5.559.25 (I previously used the latest released version, but upgraded in hopes it might resolve the issue). I've tried replacing my Assert statement with Assert.IsTrue(<expression that evaluates to true>), but I haven't had any luck. If anyone has encountered this problem and has recommendations for how to resolve it, I would appreciate your input.
Sorry for the delayed answer.
Could you please reproduce this issue in a sample solution and send it to us?
Thanks in advance.
After some time looking at the issue, I discovered that the test was legitimately failing. What was happening was I had two objects in a List that was sorted based on a sort value assigned to those objects. For my test data, the sort values were equivalent. When I passed the List into the method I was testing and a supposed-to-be-equivalent List came back as a result, the resulting List had swapped the two objects in the List, which was a valid operation in my code, so when I compared the two Lists by index the test failed. Because this did not happen when I ran the test in debug, I didn't catch it at first. I've attached a sample solution that illustrates this in case you want to look at why the results were inconsistent.
Thanks for the info!
Glad to hear that you've found the reason for this problem.