Skip to content

Commit

Permalink
Merge pull request #404 from tonyhallett/remove_empty_from_CommonAsse…
Browse files Browse the repository at this point in the history
…mblyExcludesIncludes

remove IsNullOrWhiteSpace for common exclude / includes
  • Loading branch information
tonyhallett authored Mar 12, 2024
2 parents 90bddcf + b3299b9 commit a5fb411
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions FineCodeCoverageTests/CoverageProject_Settings_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ public async Task Should_Provide_The_Merged_Result_Using_Project_Settings_Async(
}

[Test]
public async Task Should_Add_Common_Assembly_Excludes_Includes_Async()
public async Task Should_Add_Common_Assembly_Excludes_Includes_Ignoring_Whitespace_Async()
{
var mockAppOptions = new Mock<IAppOptions>();
mockAppOptions.SetupAllProperties();
Expand All @@ -732,8 +732,8 @@ public async Task Should_Add_Common_Assembly_Excludes_Includes_Async()
appOptions.Include = new string[] { "oldinclude" };
appOptions.ModulePathsExclude = new string[] { "msexclude" };
appOptions.ModulePathsInclude = new string[] { "msinclude" };
appOptions.ExcludeAssemblies = new string[] { "excludeassembly" };
appOptions.IncludeAssemblies = new string[] { "includeassembly" };
appOptions.ExcludeAssemblies = new string[] { "excludeassembly", " "};
appOptions.IncludeAssemblies = new string[] { "includeassembly", " "};

var autoMoqer = new AutoMoqer();
var coverageProjectSettingsManager = autoMoqer.Create<CoverageProjectSettingsManager>();
Expand Down
7 changes: 4 additions & 3 deletions SharedProject/Core/Model/CoverageProjectSettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ private void AddCommonAssemblyExcludesIncludes(IAppOptions appOptions)
}
var newMs = ListFromExisting(ms);
var newOldStyle = ListFromExisting(oldStyle);

common.ToList().ForEach(assemblyFileName =>

var nonWhitespaceCommon = common.Where(c => !string.IsNullOrWhiteSpace(c));
foreach(var assemblyFileName in nonWhitespaceCommon)
{
var msModulePath = $".*\\{assemblyFileName}.dll$";
newMs.Add(msModulePath);
var old = $"[{assemblyFileName}]*";
newOldStyle.Add(old);
});
}

return (newOldStyle.ToArray(), newMs.ToArray());
}
Expand Down

0 comments on commit a5fb411

Please sign in to comment.