File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
TestStack.ConventionTests/ConventionData Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 3
3
using System ;
4
4
using System . Collections . Generic ;
5
5
using System . Linq ;
6
+ using System . Runtime . CompilerServices ;
6
7
7
8
/// <summary>
8
9
/// This is where we set what our convention is all about.
@@ -20,12 +21,19 @@ public Types(string descriptionOfTypes)
20
21
21
22
public bool HasData { get { return TypesToVerify . Any ( ) ; } }
22
23
23
- public static Types InAssemblyOf < T > ( )
24
+ public static Types InAssemblyOf < T > ( bool excludeCompilerGeneratedTypes = true )
24
25
{
25
26
var assembly = typeof ( T ) . Assembly ;
27
+ var typesToVerify = assembly . GetTypes ( ) ;
28
+ if ( excludeCompilerGeneratedTypes )
29
+ {
30
+ typesToVerify = typesToVerify
31
+ . Where ( t => ! t . GetCustomAttributes ( typeof ( CompilerGeneratedAttribute ) , true ) . Any ( ) )
32
+ . ToArray ( ) ;
33
+ }
26
34
return new Types ( assembly . GetName ( ) . Name )
27
35
{
28
- TypesToVerify = assembly . GetTypes ( )
36
+ TypesToVerify = typesToVerify
29
37
} ;
30
38
}
31
39
You can’t perform that action at this time.
0 commit comments