@@ -23,53 +23,16 @@ public static string AddEscapeQuotes(string arg)
23
23
[ Export ( typeof ( IOpenCoverExeArgumentsProvider ) ) ]
24
24
internal class OpenCoverExeArgumentsProvider : IOpenCoverExeArgumentsProvider
25
25
{
26
- private static readonly Regex AssemblyRegex = new Regex ( @"^\[(.*?)\]" , RegexOptions . Compiled ) ;
27
26
private enum Delimiter { Semicolon , Space }
28
27
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
-
65
28
private void AddFilter ( ICoverageProject project , List < string > opencoverSettings )
66
29
{
67
30
var includes = SanitizeExcludesOrIncludes( project . Settings . Include ) ;
68
31
var excludes = SanitizeExcludesOrIncludes ( project . Settings . Exclude ) . ToList ( ) ;
69
32
70
33
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 ( ) ) )
73
36
{
74
37
includedModules. Add ( project . ProjectName ) ;
75
38
}
0 commit comments