Hi,
I'm running 3.3.0.6 in VS2015.
I have a SUT that NCrunch is reporting as not fully covered. 2 out of 5 properties on the SUT are shown as covered, the other 3 uncovered. But I do have tests covering all properties and have verified those tests are running (and reset the execution engine to be sure).
Here's an example of a test that is _not_ detecting as covering the PhotoUri property:
Code:
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("foo")]
[InlineData("bar")]
public void photo_uri_reflects_campus(string photoUri)
{
var campus = new CampusMockBuilder()
.WithPhotoUri(photoUri)
.Build();
var sut = new CampusViewModelBuilder()
.WithCampus(campus)
.Build();
Assert.Equal(photoUri, sut.PhotoUri);
}
But if I add this test the PhotoUri property _is_ detected as covered (but only by a single test):
Code:
[Fact]
public void foo()
{
var sut = new CampusViewModelBuilder()
.Build();
Assert.Null(sut.PhotoUri);
}
On a hunch, I tried changing it to a theory (suspicious that theories weren't contributing to coverage statistics):
Code:
[Theory]
[InlineData(1)]
public void foo(int whatever)
{
var sut = new CampusViewModelBuilder()
.Build();
Assert.Null(sut.PhotoUri);
}
But this _still_ reported PhotoUri as covered (again, by this single test).
I then removed the foo test and tried commenting out [InlineData("")] in the original test, letting tests run, then uncommenting it. Sure enough, this time the engine picked it up and shows it as covered.
What would cause this?
Thanks
PS. gods bbcode is super painful