public void TestMethod1() { Expect.On(log) .Any .GetProperty(x => x.IsTraceEnabled) .WillReturn(true); Expect.On(log) .Any .Method(x => x.Trace(null as object)) .WithAnyArguments() .Will(Collect.MethodArgument(0, delegate(object arg) { if (arg is string) { Trace.WriteLine(arg); } if (arg is Action <FormatMessageHandler> ) { //(arg as Action<FormatMessageHandler>).Invoke(); } })); //Expect.On(log) // .Any // .Method(x => x.Trace(null as Action<FormatMessageHandler>)) // .WithAnyArguments(); //Expect.On(log) // .Any // .Method(x => x.Info(null as Action<FormatMessageHandler>)) // .WithAnyArguments(); //Expect.On(log) // .Any // .Method(x => x.Error(null as Action<FormatMessageHandler>)) // .WithAnyArguments(); log.Trace("hello"); log.Trace(m => m("hello 2")); }