Skip to content

Commit a398dca

Browse files
committed
Add test case for issue autofac#1040
1 parent 5c468f6 commit a398dca

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/Autofac.Test/Features/OpenGenerics/ComplexGenericsTests.cs

+11
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,17 @@ public void ResolveTypeFromOpenGenericInterfaceTypeParameterIsInterfaceWithConst
341341
var instance = container.Resolve<INested<ISimpleInterface>>();
342342
}
343343

344+
[Fact]
345+
public void CheckGenericTypeIsRegisteredWhenNotSpecifyParameterType()
346+
{
347+
// Issue #1040: IsRegistered throws IndexOutOfRangeException for open generic type
348+
var cb = new ContainerBuilder();
349+
cb.RegisterGeneric(typeof(C<>));
350+
var container = cb.Build();
351+
352+
Assert.False(container.IsRegistered(typeof(C<>)));
353+
}
354+
344355
private class CNestedSimpleInterface : INested<ISimpleInterface>
345356
{
346357
}

0 commit comments

Comments
 (0)