codecov / codecov-exe

.exe report uploader for Codecov https://codecov.io
MIT License
25 stars 21 forks source link

Why is line red? #41

Closed janssenr closed 5 years ago

janssenr commented 6 years ago

https://codecov.io/gh/janssenr/RaboOmniKassaApi.Net/src/master/src/RaboOmniKassaApi.Tests/Models/Response/MerchantOrderResponseTest.cs Why is line 23 marked as red?

AdmiringWorm commented 6 years ago

@janssenr that would be because the unit test runner never reaches the actual end of the unit test.

Because you're testing an exception, the execution stops at line 21.

But more basically, that's what OpenCover reports, and codecov uses those reports.

AdmiringWorm commented 5 years ago

@janssenr before I close this issue, I'll leave you with a tip on how to get around it showing the red line (other than ignoring unit testing libraries in the coverage report).

Change your unit test to be along the lines of:

[TestMethod]
public void TestThatInvalidSignatureExceptionIsThrownWhenTheSignaturesDoNotMatch()
{
    Assert.ThrowsException(() => MerchantOrderResponseBuilder.InvalidSignatureInstance());
}

See the API documents for additional overloads if you need them: https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.testtools.unittesting.assert.throwsexception