improve error message

pull/59/head
theKBro 3 years ago
parent 20f78594c4
commit 930bd9ca8a
  1. 6
      Test.LightweightIocContainer.Validation/IocValidatorTest.cs

@ -150,13 +150,13 @@ public class IocValidatorTest
if (aggregateException?.InnerExceptions[0] is not NoMatchingConstructorFoundException noMatchingConstructorFoundException) if (aggregateException?.InnerExceptions[0] is not NoMatchingConstructorFoundException noMatchingConstructorFoundException)
{ {
Assert.Fail("inner exception is not of type NoMatchingConstructorFoundException"); Assert.Fail($"{nameof(aggregateException.InnerExceptions)} is not of type {nameof(NoMatchingConstructorFoundException)}");
return; return;
} }
if (noMatchingConstructorFoundException.InnerExceptions[0] is not ConstructorNotMatchingException iTest2CtorNotMatchingException) if (noMatchingConstructorFoundException.InnerExceptions[0] is not ConstructorNotMatchingException iTest2CtorNotMatchingException)
{ {
Assert.Fail("inner exception is not of type ConstructorNotMatchingException"); Assert.Fail($"{nameof(aggregateException.InnerExceptions)} is not of type {nameof(ConstructorNotMatchingException)}");
return; return;
} }
@ -182,6 +182,6 @@ public class IocValidatorTest
if (exception is NoMatchingConstructorFoundException noMatchingConstructorFoundException) if (exception is NoMatchingConstructorFoundException noMatchingConstructorFoundException)
Assert.AreEqual(typeof(T), noMatchingConstructorFoundException.Type); Assert.AreEqual(typeof(T), noMatchingConstructorFoundException.Type);
else else
Assert.Fail($"Exception is no NoMatchingConstructorFoundException, actual type: {exception?.GetType()}"); Assert.Fail($"Exception is no {nameof(NoMatchingConstructorFoundException)}, actual type: {exception?.GetType()}");
} }
} }
Loading…
Cancel
Save