Exemplo n.º 1
0
 /// <summary>
 /// Expects that the Actual type implements the interface provided
 /// as a generic parameter
 /// </summary>
 /// <param name="not">Continuation to operate on</param>
 /// <param name="customMessage">Custom message to add to failure messages</param>
 /// <typeparam name="TInterface">Interface type to look for</typeparam>
 /// <returns></returns>
 public static IMore <Type> Implement <TInterface>(
     this INotAfterTo <Type> not,
     string customMessage
     )
 {
     return(not.Implement <TInterface>(() => customMessage));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Tests whether the Actual string is matched by the given Regex
 /// </summary>
 /// <param name="matcher">Continuation to operate on</param>
 /// <param name="regex">Regex string to match with</param>
 /// <returns>More continuation for Actual string</returns>
 public static IStringMore Match(
     this INotAfterTo <string> matcher,
     string regex
     )
 {
     return(matcher.Match(regex, NULL_STRING));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Tests whether the Actual string is matched by the given Regex
 /// </summary>
 /// <param name="matcher">Continuation to operate on</param>
 /// <param name="regex">Regex string to match with</param>
 /// <param name="customMessage">Custom message to add to failure messages</param>
 /// <returns>More continuation for Actual string</returns>
 public static IStringMore Match(
     this INotAfterTo <string> matcher,
     string regex,
     string customMessage
     )
 {
     return(matcher.Match(regex, () => customMessage));
 }
 /// <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>
 /// 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="customMessage">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,
     string customMessage
     )
 {
     continuation.Match(test, () => customMessage);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Expects that the Actual type implements the interface provided
 /// as a generic parameter
 /// </summary>
 /// <param name="not">Continuation to operate on</param>
 /// <param name="expected">Interface type which should be implemented</param>
 /// <param name="customMessageGenerator">Generates a custom message to add to failure messages</param>
 /// <returns></returns>
 public static IMore <Type> Implement(
     this INotAfterTo <Type> not,
     Type expected,
     Func <string> customMessageGenerator
     )
 {
     return(not.AddImplementsMatcher(expected, customMessageGenerator));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Expects that the Actual type implements the interface provided
 /// as a generic parameter
 /// </summary>
 /// <param name="not">Continuation to operate on</param>
 /// <param name="expected">Interface type which should be implemented</param>
 /// <param name="customMessage">Custom message to add to failure messages</param>
 /// <returns></returns>
 public static IMore <Type> Implement(
     this INotAfterTo <Type> not,
     Type expected,
     string customMessage
     )
 {
     return(not.Implement(expected, () => customMessage));
 }
 /// <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="customMessage">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,
     string customMessage
     ) where T : struct
 {
     return(continuation.Equal(expected, () => customMessage));
 }
Exemplo n.º 9
0
 /// <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="customMessage">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,
     string customMessage
     ) where T : struct
 {
     continuation.Equal(expected, () => customMessage);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Tests whether the Actual string is matched by the given Regex
 /// </summary>
 /// <param name="matcher">Continuation to operate on</param>
 /// <param name="regex">Regex string to match with</param>
 /// <param name="customMessageGenerator">Custom message to add to failure messages</param>
 /// <returns>More continuation for Actual string</returns>
 public static IStringMore Match(
     this INotAfterTo <string> matcher,
     string regex,
     Func <string> customMessageGenerator
     )
 {
     AddRegexMatcher(matcher, regex, customMessageGenerator);
     return(matcher.More());
 }
Exemplo n.º 11
0
 /// <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)
                ));
 }
Exemplo n.º 12
0
 /// <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)
         );
 }
Exemplo n.º 13
0
 /// <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
                    )
                ));
 }
Exemplo n.º 14
0
 /// <summary>
 /// Expects that the Actual type implements the interface provided
 /// as a generic parameter
 /// </summary>
 /// <param name="not">Continuation to operate on</param>
 /// <typeparam name="TBase">Interface type to look for</typeparam>
 /// <returns></returns>
 public static IMore <Type> Inherit <TBase>(
     this INotAfterTo <Type> not
     )
 {
     return(not.Inherit <TBase>(NULL_STRING));
 }
Exemplo n.º 15
0
 /// <summary>
 /// Expects that the Actual type implements the interface provided
 /// as a generic parameter
 /// </summary>
 /// <param name="not">Continuation to operate on</param>
 /// <typeparam name="TInterface">Interface type to look for</typeparam>
 /// <returns></returns>
 public static IMore <Type> Implement <TInterface>(
     this INotAfterTo <Type> not
     )
 {
     return(not.Implement <TInterface>(NULL_STRING));
 }
Exemplo n.º 16
0
 /// <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>
 /// <typeparam name="T">Type of the object being tested</typeparam>
 public static IMore <T> Be <T>(this INotAfterTo <T> be, object expected)
 {
     return(be.Be(expected, NULL_STRING));
 }