Ejemplo n.º 1
0
 /// <summary>
 /// Tests if a substitute has received any calls whatsoever
 /// </summary>
 /// <param name="been"></param>
 /// <param name="customMessage"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns>IMore&lt;T&gt; continuation</returns>
 public static IMore <T> Called <T>(
     this IBeen <T> been,
     string customMessage
     ) where T : class
 {
     return(been.Called(() => customMessage));
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Tests if a substitute has received any calls whatsoever
 /// </summary>
 /// <param name="been"></param>
 /// <param name="messageGenerator"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns>IMore&lt;T&gt; continuation</returns>
 public static IMore <T> Called <T>(
     this IBeen <T> been,
     Func <string> messageGenerator
     ) where T : class
 {
     return(been.AddMatcher(actual =>
     {
         try
         {
             var all = actual.ReceivedCalls().ToArray();
             var passed = all.Any();
             return new MatcherResult(
                 passed,
                 MessageHelpers.FinalMessageFor(
                     () => DumpCalls(all, passed),
                     messageGenerator
                     )
                 );
         }
         catch (NotASubstituteException)
         {
             // can't have a matcher result as negation gets in the way
             throw new UnmetExpectationException(
                 $"{actual} is not a substitute"
                 );
         }
     }));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Tests if a substitute has received any calls whatsoever
 /// </summary>
 /// <param name="been"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns>IMore&lt;T&gt; continuation</returns>
 public static IMore <T> Called <T>(
     this IBeen <T> been
     ) where T : class
 {
     return(been.Called(MessageHelpers.NULL_STRING));
 }