File tree 1 file changed +24
-1
lines changed 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 9
9
using LibGit2Sharp . Tests . TestHelpers ;
10
10
using Xunit ;
11
11
using Xunit . Extensions ;
12
+ using Moq ;
12
13
13
14
namespace LibGit2Sharp . Tests
14
15
{
@@ -107,6 +108,28 @@ public void TypesInLibGit2SharpMustBeExtensibleInATestingContext()
107
108
{
108
109
nonTestableTypes . Add ( type , new List < string > ( ) ) ;
109
110
}
111
+
112
+ if ( type . IsAbstract )
113
+ {
114
+ continue ;
115
+ }
116
+
117
+ try
118
+ {
119
+ if ( type . ContainsGenericParameters )
120
+ {
121
+ var constructType = type . MakeGenericType ( Enumerable . Repeat ( typeof ( object ) , type . GetGenericArguments ( ) . Length ) . ToArray ( ) ) ;
122
+ Activator . CreateInstance ( constructType , true ) ;
123
+ }
124
+ else
125
+ {
126
+ Activator . CreateInstance ( type , true ) ;
127
+ }
128
+ }
129
+ catch ( Exception ex )
130
+ {
131
+ nonTestableTypes . Add ( type , new List < string > ( ) ) ;
132
+ }
110
133
}
111
134
112
135
if ( nonTestableTypes . Any ( ) )
@@ -246,7 +269,7 @@ public void GetEnumeratorMethodsInLibGit2SharpMustBeVirtualForTestability()
246
269
var nonVirtualGetEnumeratorMethods = Assembly . GetAssembly ( typeof ( IRepository ) )
247
270
. GetExportedTypes ( )
248
271
. Where ( t =>
249
- t . Namespace == typeof ( IRepository ) . Namespace &&
272
+ t . Namespace == typeof ( IRepository ) . Namespace &&
250
273
! t . IsSealed &&
251
274
! t . IsAbstract &&
252
275
t . GetInterfaces ( ) . Any ( i => i . IsAssignableFrom ( typeof ( IEnumerable < > ) ) ) )
You can’t perform that action at this time.
0 commit comments