Beispiel #1
0
 public static ITestValidationWith WithErrorCode(this ITestValidationContinuation failures, string expectedErrorCode)
 {
     return(failures.When(failure => failure.ErrorCode == expectedErrorCode, string.Format("Expected an error code of '{0}'. Actual error code was '{{Code}}'", expectedErrorCode)));
 }
Beispiel #2
0
 public static ITestValidationWith WithErrorMessage(this ITestValidationContinuation failures, string expectedErrorMessage)
 {
     return(failures.When(failure => failure.ErrorMessage == expectedErrorMessage, string.Format("Expected an error message of '{0}'. Actual message was '{{Message}}'", expectedErrorMessage)));
 }
Beispiel #3
0
 public static ITestValidationWith WithCustomState(this ITestValidationContinuation failures, object expectedCustomState, IEqualityComparer comparer = null)
 {
     return(failures.When(failure => comparer?.Equals(failure.CustomState, expectedCustomState) ?? Equals(failure.CustomState, expectedCustomState), string.Format("Expected custom state of '{0}'. Actual state was '{{State}}'", expectedCustomState)));
 }
Beispiel #4
0
 public static ITestValidationWith WithMessageArgument <T>(this ITestValidationContinuation failures, string argumentKey, T argumentValue)
 {
     return(failures.When(failure => failure.FormattedMessagePlaceholderValues.ContainsKey(argumentKey) && ((T)failure.FormattedMessagePlaceholderValues[argumentKey]).Equals(argumentValue),
                          string.Format("Expected message argument '{0}' with value '{1}'. Actual value was '{{MessageArgument:{0}}}'", argumentKey, argumentValue.ToString())));
 }
Beispiel #5
0
 public static ITestValidationWith WithSeverity(this ITestValidationContinuation failures, Severity expectedSeverity)
 {
     return(failures.When(failure => failure.Severity == expectedSeverity, string.Format("Expected a severity of '{0}'. Actual severity was '{{Severity}}'", expectedSeverity)));
 }