Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
David Müller authored and daveMueller committed Mar 23, 2021
1 parent 0798aab commit 89600ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
15 changes: 7 additions & 8 deletions src/coverlet.core/CoverageDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@ namespace Coverlet.Core
internal class CoverageDetails
{
private double _averageModulePercent;
private double _covered;

public double Covered
public Modules Modules { get; internal set; }
public double Covered { get; internal set; }
public int Total { get; internal set; }
public double Percent
{
get => _covered;
internal set
get
{
_covered = value;
Percent = Total == 0 ? 100D : Math.Floor((_covered / Total) * 10000) / 100;
if (Modules?.Count == 0) return 0;
return Total == 0 ? 100D : Math.Floor((Covered / Total) * 10000) / 100;
}
}

public int Total { get; internal set; }
public double Percent { get; internal set; }
public double AverageModulePercent
{
get { return Math.Floor(_averageModulePercent * 100) / 100; }
Expand Down
6 changes: 3 additions & 3 deletions src/coverlet.core/CoverageSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public CoverageDetails CalculateLineCoverage(Documents documents)

public CoverageDetails CalculateLineCoverage(Modules modules)
{
var details = new CoverageDetails();
var details = new CoverageDetails{Modules = modules};
var accumPercent = 0.0D;

if (modules.Count == 0)
Expand Down Expand Up @@ -189,7 +189,7 @@ public CoverageDetails CalculateBranchCoverage(Documents documents)

public CoverageDetails CalculateBranchCoverage(Modules modules)
{
var details = new CoverageDetails();
var details = new CoverageDetails{ Modules = modules };
var accumPercent = 0.0D;

if (modules.Count == 0)
Expand Down Expand Up @@ -253,7 +253,7 @@ public CoverageDetails CalculateMethodCoverage(Documents documents)

public CoverageDetails CalculateMethodCoverage(Modules modules)
{
var details = new CoverageDetails();
var details = new CoverageDetails{ Modules = modules };
var accumPercent = 0.0D;

if (modules.Count == 0)
Expand Down

0 comments on commit 89600ac

Please sign in to comment.