|
|
|
|
@ -41,6 +41,12 @@ public class IocValidatorTest |
|
|
|
|
[UsedImplicitly] |
|
|
|
|
public class GenericTest<T> : IGenericTest<T> where T : IConstraint, new(); |
|
|
|
|
|
|
|
|
|
[UsedImplicitly] |
|
|
|
|
public interface IGenericTestWithoutConstraint<T>; |
|
|
|
|
|
|
|
|
|
[UsedImplicitly] |
|
|
|
|
public class GenericTestWithoutConstraint<T> : IGenericTestWithoutConstraint<T>; |
|
|
|
|
|
|
|
|
|
[UsedImplicitly] |
|
|
|
|
public interface IGenericTestFactory |
|
|
|
|
{ |
|
|
|
|
@ -59,6 +65,15 @@ public class IocValidatorTest |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[UsedImplicitly] |
|
|
|
|
public class GenericParameterWithoutConstraint : IGenericParameter |
|
|
|
|
{ |
|
|
|
|
public GenericParameterWithoutConstraint(IGenericTestWithoutConstraint<IParameter> test) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[UsedImplicitly] |
|
|
|
|
private class TestViewModelDontIgnoreDesignTimeCtor : ITest |
|
|
|
|
{ |
|
|
|
|
@ -322,6 +337,17 @@ public class IocValidatorTest |
|
|
|
|
validator.Validate(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[Test] |
|
|
|
|
public void TestValidateOpenGenericTypeWithoutConstraintAsParameter() |
|
|
|
|
{ |
|
|
|
|
IocContainer iocContainer = new(); |
|
|
|
|
iocContainer.Register(r => r.AddOpenGenerics(typeof(IGenericTestWithoutConstraint<>), typeof(GenericTestWithoutConstraint<>))); |
|
|
|
|
iocContainer.Register(r => r.Add<IGenericParameter, GenericParameterWithoutConstraint>()); |
|
|
|
|
|
|
|
|
|
IocValidator validator = new(iocContainer); |
|
|
|
|
validator.Validate(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void AssertNoMatchingConstructorFoundForType<T>(AggregateException aggregateException) |
|
|
|
|
{ |
|
|
|
|
Exception exception = aggregateException?.InnerExceptions[0]; |
|
|
|
|
|