Ejemplo n.º 1
0
 /// <summary>Asserts that the given result contains an error grouped by the given key which contains the given substring. Pretty prints the actual errors on assertion failure.</summary>
 /// <param name="result">The result under test</param>
 /// <param name="expectedKey">The key which should reference a group of error messages in the result</param>
 /// <param name="expectedSubString">A portion of an error message which should be keyed by the given key</param>
 protected void AssertSomeDataError(ValidationStatus result, string expectedKey, string expectedSubString)
 {
     Assert.AreEqual(OverallStatus.DataError, result.Disposition);
     Assert.IsTrue(result.MessagesFor(expectedKey)
                   .Any(message => message.Contains(expectedSubString)),
                   $"Expected error containing { expectedSubString } not found. "
                   + AllErrorsPrettyPrinted(result));
 }