Skip to content

Commit

Permalink
check null value for coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Bertk committed Feb 23, 2023
1 parent da9cacf commit dc1e8d4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/coverlet.integration.tests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,14 @@ private protected void AssertCoverage(ClonedTemplateProject clonedTemplateProjec
bool coverageChecked = false;
foreach (string coverageFile in clonedTemplateProject.GetFiles(filter))
{
#pragma warning disable CS8604 // Possible null reference argument.
JsonConvert.DeserializeObject<Modules>(File.ReadAllText(coverageFile))
.Document("DeepThought.cs")
Modules? coverage = JsonConvert.DeserializeObject<Modules>(File.ReadAllText(coverageFile));
Assert.NotNull(coverage);
coverage.Document("DeepThought.cs")
.Class("Coverlet.Integration.Template.DeepThought")
.Method("System.Int32 Coverlet.Integration.Template.DeepThought::AnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything()")
.AssertLinesCovered((6, 1), (7, 1), (8, 1));
#pragma warning restore CS8604 // Possible null reference argument.
coverageChecked = true;
}

Assert.True(coverageChecked, $"Coverage check fail\n{standardOutput}");
}
}
Expand Down

0 comments on commit dc1e8d4

Please sign in to comment.