public void CallIsReplaced() { var dummy = new MethodReplacement(); Action<string> replacement = s => dummy.Call("Intercepted."); InterceptorRegistry.AddInterceptor( new CompoundInterceptor(new AlwaysMatches(), new InsteadOfCall(() => replacement) )); var mocked = new CodeUnderTest(); mocked.CallsConsoleWriteLine(); Assert.AreEqual("Intercepted.", dummy.ReplacementArg1); }
public void OriginalArgumentIsCaptured() { string suppliedArgument = null; Action<string> replacement = s => suppliedArgument = s; InterceptorRegistry.AddInterceptor( new CompoundInterceptor(new AlwaysMatches(), new InsteadOfCall(() => replacement))); var mocked = new CodeUnderTest(); mocked.CallsConsoleWriteLine(); Assert.AreEqual("This should not appear.", suppliedArgument); }