-
Notifications
You must be signed in to change notification settings - Fork 392
Coverage percentage output value rounded down with max 2 decimal precision #397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2bc7f0a
9586b91
66dad3b
2201898
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,18 @@ public class CoverageDetails | |
public int Total { get; internal set; } | ||
public double Percent | ||
{ | ||
get => Math.Round(Total == 0 ? 1 : Covered / Total, 3); | ||
get => Math.Round(Total == 0 ? 1 : Covered / Total, 4); | ||
|
||
} | ||
|
||
public double GetCoveragePercentage() | ||
|
||
{ | ||
double percentage = Percent * 100; | ||
return RoundDown(percentage); | ||
} | ||
|
||
private double RoundDown(double percentage) | ||
|
||
{ | ||
return Math.Floor(percentage * 100) / 100; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be
var totalLinePercent = summary.CalculateLineCoverage(result.Modules).Percent
if you update thePercent
property to contain the necessary calculations. Applies everywhere this new method is used