/// <summary> /// Match the value under test with a simple Func which takes in your value /// and returns true if the test should pass. /// </summary> /// <param name="continuation">Continuation to act on</param> /// <param name="test">Func to test the original value with</param> /// <param name="customMessageGenerator">Generates a custom message to include in the result upon failure</param> /// <typeparam name="T"></typeparam> public static void Match <T>( this INotAfterTo <T> continuation, Func <T, bool> test, Func <string> customMessageGenerator ) { continuation.AddMatcher(MatchMatcherFor(test, customMessageGenerator)); }
/// <summary> /// Performs equality checking -- the end of .To.Equal() /// </summary> /// <param name="continuation">Continuation to operate on</param> /// <param name="expected">Expected value</param> /// <param name="customMessageGenerator">Generates a custom message to add to failure messages</param> /// <typeparam name="T">Type of object being tested</typeparam> public static IMore <T> Equal <T>( this INotAfterTo <T> continuation, T?expected, Func <string> customMessageGenerator ) where T : struct { return(continuation.AddMatcher( GenerateNullableEqualityMatcherFor(expected, customMessageGenerator) )); }
/// <summary> /// Performs equality checking -- the end of .To.Equal() /// </summary> /// <param name="continuation">Continuation to operate on</param> /// <param name="expected">Expected value</param> /// <param name="customMessageGenerator">Generates a custom message to add to failure messages</param> /// <typeparam name="T">Type of object being tested</typeparam> public static void Equal <T>( this INotAfterTo <T> continuation, T expected, Func <string> customMessageGenerator ) { continuation.AddMatcher( GenerateEqualityMatcherFor(expected, customMessageGenerator) ); }
/// <summary> /// Performs reference equality checking between your actual and the provided expected value /// </summary> /// <param name="be">Continuation to operate on</param> /// <param name="expected">Expected value</param> /// <param name="customMessageGenerator">Generates a custom message to add to failure messages</param> /// <typeparam name="T">Type of the object being tested</typeparam> public static IMore <T> Be <T>( this INotAfterTo <T> be, object expected, Func <string> customMessageGenerator) { return(be.AddMatcher( CreateRefEqualMatcherFor <T>( expected, customMessageGenerator ) )); }