private static IResolveConstraint GetResolveConstrains(ValidationCase validationCase) { if (!validationCase.shouldRaiseError) { return(Throws.Nothing); } Constraint result = Throws.InstanceOf(validationCase.ExceptionType); return(validationCase.exceptionSubstrings.Aggregate(result, (current, line) => current.And.Message.Contains(line))); }
public void ExceptionRaiseTest(ValidationCase validationCase) { Assert.That(new TestDelegate(validationCase.ActionToTest), GetResolveConstrains(validationCase)); }