File tree 2 files changed +10
-2
lines changed
AutofacContrib.NSubstitute/MockHandlers
AutofacContrib.NSubstitute.Tests
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ public void ManuallyCheckTypeToSkipOpenGeneric()
62
62
. Build ( ) ;
63
63
64
64
Assert . Throws < ComponentNotRegisteredException > ( ( ) => mock . Resolve < IDependency < object > > ( ) ) ;
65
+ Assert . That ( mock . Resolve < IDependency2 < object > > ( ) , Is . NSubstituteMock ) ;
65
66
}
66
67
67
68
[ Test ]
@@ -81,6 +82,10 @@ public interface IDependency
81
82
{
82
83
}
83
84
85
+ public interface IDependency2 < T >
86
+ {
87
+ }
88
+
84
89
public interface IDependency < T >
85
90
{
86
91
}
Original file line number Diff line number Diff line change @@ -41,9 +41,12 @@ protected internal override void OnMockCreating(MockCreatingContext context)
41
41
{
42
42
foreach ( var type in _types )
43
43
{
44
- if ( type . IsGenericType && type == type . GetGenericTypeDefinition ( ) )
44
+ if ( type . IsGenericType && context . Type . IsGenericType )
45
45
{
46
- context . DoNotCreate ( ) ;
46
+ if ( context . Type . GetGenericTypeDefinition ( ) == type . GetGenericTypeDefinition ( ) )
47
+ {
48
+ context . DoNotCreate ( ) ;
49
+ }
47
50
}
48
51
else if ( type == context . Type )
49
52
{
You can’t perform that action at this time.
0 commit comments