Skip to content
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

remove IsNullOrWhiteSpace for common exclude / includes #404

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading