/// <summary> /// Verifies that the <paramref name="actualValue"/> is matched by the <paramref name="matcher"/>. /// </summary> /// <param name="actualValue">The actual value.</param> /// <param name="matcher">The matcher.</param> /// <exception cref="ExpectationException">Thrown if value does not match.</exception> public static void That(object actualValue, Matcher matcher) { if (!matcher.Matches(actualValue)) { var writer = new StringDescriptionWriter(); WriteDescriptionOfFailedMatch(writer, actualValue, matcher); throw new ExpectationException(writer.ToString()); } }
/// <summary> /// Verifies that the <paramref name="actualValue"/> is matched by the <paramref name="matcher"/>. /// </summary> /// <param name="actualValue">The actual value to match.</param> /// <param name="matcher">The matcher.</param> /// <param name="message">The error message.</param> /// <param name="formatArgs">The format args for the error message.</param> /// <exception cref="ExpectationException">Thrown if value does not match.</exception> public static void That(object actualValue, Matcher matcher, string message, params object[] formatArgs) { if (!matcher.Matches(actualValue)) { var writer = new StringDescriptionWriter(); writer.AppendTextFormat(message, formatArgs); WriteDescriptionOfFailedMatch(writer, actualValue, matcher); throw new ExpectationException(writer.ToString()); } }