NCover seems to refuse to report coverage from NUnit parameterized tests.
This goes fine:
[Test]
public void CreateImportTvShowsModelTests()
{
var importTvShowsModel = new ImportTvShowsModel(_fileUtilities, null, _tvShowLibrary, new ProgressModel());
Assert.IsNotNull(importTvShowsModel.TvShowLibrary);
}
This is ignored in the coverage report:
[TestCase(false, true, true)]
[TestCase(false, false, true)]
[TestCase(true, true, false)]
[TestCase(false, false, true)]
public void ToggleSelectAll(bool firstSelected, bool secondSelected, bool resultAllSelected)
{
// Go into some trouble to use actual DownloadedEpisodes (not mocks) because we need to validate
// the IsSelected propery. Mocking the IsSelected property on DownloadedEpisode superseeds the whole purpose
var matcher = MockRepository.GenerateMock<ISeasonAndEpisodeMatcher>();
var tvShowsLibrary = MockRepository.GenerateMock<ITvShowsLibrary>();
tvShowsLibrary.Expect(library => library.PossibleCorrespondingTvShows(string.Empty))
.IgnoreArguments()
.Return(new List<ITvShow>());
var downloadedEpisode1 = new DownloadedEpisode(@"D:\bla.mkv", matcher, tvShowsLibrary) {IsSelected = firstSelected};
var downloadedEpisode2 = new DownloadedEpisode(@"D:\bla.mkv", matcher, tvShowsLibrary) {IsSelected = secondSelected};
var downloadedEpisodes = new ObservableCollection<IDownloadedEpisode> { downloadedEpisode1, downloadedEpisode2 };
var importTvShowsModel = new ImportTvShowsModel(_fileUtilities, downloadedEpisodes, _tvShowLibrary, _progressModel);
importTvShowsModel.ToggleSelectAll();
Assert.AreEqual(resultAllSelected, downloadedEpisode1.IsSelected);
Assert.AreEqual(resultAllSelected, downloadedEpisode2.IsSelected);
}
Of course in both cases the tests are executed and all succeed.
Can I tweak NCover in a way that it does report the coverage for parameterized tests?
updated to latest version (4.5.2483.*) and now it is a supported feature. \o/