@@ -23,53 +23,16 @@ public static string AddEscapeQuotes(string arg)
2323 [ Export ( typeof ( IOpenCoverExeArgumentsProvider ) ) ]
2424 internal class OpenCoverExeArgumentsProvider : IOpenCoverExeArgumentsProvider
2525 {
26- private static readonly Regex AssemblyRegex = new Regex ( @"^\[(.*?)\]" , RegexOptions . Compiled ) ;
2726 private enum Delimiter { Semicolon , Space }
2827
29- private static bool IncludeTestAssemblyOnlyWhenNecessary (
30- List < IReferencedProject > includedReferencedProjects ,
31- IEnumerable < string > inclusions ,
32- List < string > exclusions ,
33- string testAssemblyName )
34- {
35- return HasInclusions ( inclusions , includedReferencedProjects ) && ! IsTestAssemblySpecificallyExcluded ( exclusions , testAssemblyName ) ;
36- }
37-
38- private static string GetAssemblyFromFilter ( string input )
39- {
40- Match match = AssemblyRegex . Match ( input ) ;
41- return match . Success ? match . Groups [ 1 ] . Value : null ;
42- }
43-
44- private static bool IsTestAssemblySpecificallyExcluded ( List < string > exclusions , string testAssemblyName )
45- {
46- // not interested in an exclude all
47-
48- // note that it could also have been excluded with a wild card - for now for simplicity we are not checking that
49- foreach ( var exclusion in exclusions)
50- {
51- var assembly = GetAssemblyFromFilter ( exclusion ) ;
52- if ( assembly = = testAssemblyName )
53- {
54- return true;
55- }
56- }
57- return false;
58- }
59-
60- private static bool HasInclusions ( IEnumerable < string > includes , List < IReferencedProject > includedReferencedProjects )
61- {
62- return includes . Any ( ) || includedReferencedProjects . Any ( ) ;
63- }
64-
6528 private void AddFilter ( ICoverageProject project , List < string > opencoverSettings )
6629 {
6730 var includes = SanitizeExcludesOrIncludes( project . Settings . Include ) ;
6831 var excludes = SanitizeExcludesOrIncludes ( project . Settings . Exclude ) . ToList ( ) ;
6932
7033 var includedModules = project . IncludedReferencedProjects . Select ( rp => rp . AssemblyName ) . ToList ( ) ;
71- if ( project . Settings . IncludeTestAssembly &&
72- IncludeTestAssemblyOnlyWhenNecessary ( project . IncludedReferencedProjects , includes , excludes , project . ProjectName ) )
34+ if ( project . Settings . IncludeTestAssembly &&
35+ ( includes . Any ( ) || project . IncludedReferencedProjects . Any ( ) ) )
7336 {
7437 includedModules. Add ( project . ProjectName ) ;
7538 }
0 commit comments