Adapted test PR #57

pull/57/head
JCH2k 4 years ago
parent 75233628d0
commit 9547685b51
  1. 13
      Test.LightweightIocContainer/IocValidatorTest.cs

@ -68,7 +68,9 @@ namespace Test.LightweightIocContainer
IocValidator validator = new(iocContainer);
validator.Validate();
var aggregateException = Assert.Throws<AggregateException>(() => validator.Validate());
AssertNoMatchingConstructorFoundForType<Test>(aggregateException);
}
[Test]
@ -108,13 +110,18 @@ namespace Test.LightweightIocContainer
IocValidator validator = new(iocContainer);
AggregateException aggregateException = Assert.Throws<AggregateException>(() => validator.Validate());
var aggregateException = Assert.Throws<AggregateException>(() => validator.Validate());
AssertNoMatchingConstructorFoundForType<Test>(aggregateException);
}
private static void AssertNoMatchingConstructorFoundForType<T>(AggregateException aggregateException)
{
Exception exception = aggregateException?.InnerExceptions[0];
Assert.IsInstanceOf<NoMatchingConstructorFoundException>(exception);
NoMatchingConstructorFoundException noMatchingConstructorFoundException = (NoMatchingConstructorFoundException)exception;
Assert.AreEqual(typeof(Test), noMatchingConstructorFoundException?.Type);
Assert.AreEqual(typeof(T), noMatchingConstructorFoundException?.Type);
}
}
}
Loading…
Cancel
Save