I always choose to mock my own abstractions and I've noticed that the parts of the abstraction that I do not need in a particular unit test are affecting the Code Coverage metrics. E.g.
Code:
private class MockDateProvider : IDateProvider
{
private readonly DateTime businessDate;
public MockDateProvider(DateTime businessDate)
{
this.businessDate = businessDate;
}
public DateTime BusinessDate
{
get { return this.businessDate; }
}
public DateTime SystemDate
{
get { throw new NotImplementedException(); }
}
}
I know the fact I can ask this question means my class may be violating SRP, but is there some way to let NCrunch know that for the purposes of this set of tests the line of code
Code:
get { throw new NotImplementedException(); }
is not supposed to be called and should be discounted?