Skip to content

Commit

Permalink
Merge pull request coverlet-coverage#154 from alexanderkozlenko/pr_ms…
Browse files Browse the repository at this point in the history
…build_case

Make enumeration-based MSBuild properties case-insensitive
  • Loading branch information
tonerdo committed Aug 1, 2018
2 parents 726a3e7 + 304e9ae commit 580f2c2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/coverlet.core/Reporters/ReporterFactory.cs
@@ -1,3 +1,4 @@
using System;
using System.Linq;
using System.Collections.Generic;

Expand All @@ -18,6 +19,6 @@ public ReporterFactory(string format)
}

public IReporter CreateReporter()
=> _reporters.FirstOrDefault(r => r.Format == _format);
=> _reporters.FirstOrDefault(r => string.Equals(r.Format, _format, StringComparison.OrdinalIgnoreCase));
}
}
6 changes: 3 additions & 3 deletions src/coverlet.msbuild.tasks/CoverageResultTask.cs
Expand Up @@ -90,19 +90,19 @@ public override bool Execute()

if (_threshold > 0)
{
if (linePercent < _threshold && thresholdTypes.Contains("line"))
if (linePercent < _threshold && thresholdTypes.Contains("line", StringComparer.OrdinalIgnoreCase))
{
exceptionBuilder.AppendLine($"'{Path.GetFileNameWithoutExtension(module.Key)}' has a line coverage '{linePercent}%' below specified threshold '{_threshold}%'");
thresholdFailed = true;
}

if (branchPercent < _threshold && thresholdTypes.Contains("branch"))
if (branchPercent < _threshold && thresholdTypes.Contains("branch", StringComparer.OrdinalIgnoreCase))
{
exceptionBuilder.AppendLine($"'{Path.GetFileNameWithoutExtension(module.Key)}' has a branch coverage '{branchPercent}%' below specified threshold '{_threshold}%'");
thresholdFailed = true;
}

if (methodPercent < _threshold && thresholdTypes.Contains("method"))
if (methodPercent < _threshold && thresholdTypes.Contains("method", StringComparer.OrdinalIgnoreCase))
{
exceptionBuilder.AppendLine($"'{Path.GetFileNameWithoutExtension(module.Key)}' has a method coverage '{methodPercent}%' below specified threshold '{_threshold}%'");
thresholdFailed = true;
Expand Down

0 comments on commit 580f2c2

Please sign in to comment.