diff --git a/Test.LightweightIocContainer.Validation/IocValidatorTest.cs b/Test.LightweightIocContainer.Validation/IocValidatorTest.cs index fc48b98..1b8480c 100644 --- a/Test.LightweightIocContainer.Validation/IocValidatorTest.cs +++ b/Test.LightweightIocContainer.Validation/IocValidatorTest.cs @@ -31,6 +31,9 @@ public class IocValidatorTest [UsedImplicitly] public interface IConstraint; + + [UsedImplicitly] + public class Constraint : IConstraint; [UsedImplicitly] public interface IGenericTest where T : IConstraint, new(); @@ -44,6 +47,18 @@ public class IocValidatorTest IGenericTest Create() where T : IConstraint, new(); } + [UsedImplicitly] + public interface IGenericParameter; + + [UsedImplicitly] + public class GenericParameter : IGenericParameter + { + public GenericParameter(IGenericTest test) + { + + } + } + [UsedImplicitly] private class TestViewModelDontIgnoreDesignTimeCtor : ITest { @@ -286,6 +301,17 @@ public class IocValidatorTest validator.Validate(); } + [Test] + public void TestValidateOpenGenericTypeAsParameter() + { + IocContainer iocContainer = new(); + iocContainer.Register(r => r.AddOpenGenerics(typeof(IGenericTest<>), typeof(GenericTest<>))); + iocContainer.Register(r => r.Add()); + + IocValidator validator = new(iocContainer); + validator.Validate(); + } + private void AssertNoMatchingConstructorFoundForType(AggregateException aggregateException) { Exception exception = aggregateException?.InnerExceptions[0];