/// <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<T> continuation</returns> public static IMore <T> Called <T>( this IBeen <T> been, string customMessage ) where T : class { return(been.Called(() => customMessage)); }
/// <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<T> 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" ); } })); }
/// <summary> /// Tests if a substitute has received any calls whatsoever /// </summary> /// <param name="been"></param> /// <typeparam name="T"></typeparam> /// <returns>IMore<T> continuation</returns> public static IMore <T> Called <T>( this IBeen <T> been ) where T : class { return(been.Called(MessageHelpers.NULL_STRING)); }