File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
AutofacContrib.NSubstitute.Tests
AutofacContrib.NSubstitute/MockHandlers Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ public void ManuallyCheckTypeToSkipOpenGeneric()
6262 . Build ( ) ;
6363
6464 Assert . Throws < ComponentNotRegisteredException > ( ( ) => mock . Resolve < IDependency < object > > ( ) ) ;
65+ Assert . That ( mock . Resolve < IDependency2 < object > > ( ) , Is . NSubstituteMock ) ;
6566 }
6667
6768 [ Test ]
@@ -81,6 +82,10 @@ public interface IDependency
8182 {
8283 }
8384
85+ public interface IDependency2 < T >
86+ {
87+ }
88+
8489 public interface IDependency < T >
8590 {
8691 }
Original file line number Diff line number Diff line change @@ -41,9 +41,12 @@ protected internal override void OnMockCreating(MockCreatingContext context)
4141 {
4242 foreach ( var type in _types )
4343 {
44- if ( type . IsGenericType && type == type . GetGenericTypeDefinition ( ) )
44+ if ( type . IsGenericType && context . Type . IsGenericType )
4545 {
46- context . DoNotCreate ( ) ;
46+ if ( context . Type . GetGenericTypeDefinition ( ) == type . GetGenericTypeDefinition ( ) )
47+ {
48+ context . DoNotCreate ( ) ;
49+ }
4750 }
4851 else if ( type == context . Type )
4952 {
You can’t perform that action at this time.
0 commit comments