Exemplo n.º 1
0
 public static void AssertNotSuccess(this IResult result, string errorMessagePattern)
 {
     if (result.State == ResultState.Success)
     {
         result.AssertNotSuccess();
     }
     else
     {
         AssertErrorMessageMatch(errorMessagePattern, result.Message);
     }
 }
Exemplo n.º 2
0
 public static void AssertNotSuccess(this IResult result, IEnumerable <string> errorMessagePatterns, string split)
 {
     if (result.State == ResultState.Success)
     {
         result.AssertNotSuccess();
     }
     else
     {
         var    results         = result.Message.Split(new[] { split }, StringSplitOptions.None).ToList();
         string unmatchedString = null;
         if (errorMessagePatterns.Any(e =>
         {
             if (results.All(r => !ErrorMessageMatch(e, r)))
             {
                 unmatchedString = e;
                 return(true);
             }
             return(false);
         }))
         {
             Assert.Fail("Could not match: \"{0}\".", unmatchedString);
         }
     }
 }