public void IntegrationTest() { ProxyFactory pf = new ProxyFactory(new TestTarget()); ILog log = A.Fake <ILog>(); SimpleLoggingAdvice loggingAdvice = new SimpleLoggingAdvice(log); pf.AddAdvice(loggingAdvice); A.CallTo(() => log.IsTraceEnabled).Returns(true); object proxy = pf.GetProxy(); ITestTarget ptt = (ITestTarget)proxy; ptt.DoSomething(); A.CallTo(() => log.Trace("Entering DoSomething")).MustHaveHappened(); A.CallTo(() => log.Trace("Exiting DoSomething")).MustHaveHappened(); }
public void IntegrationTest() { ProxyFactory pf = new ProxyFactory(new TestTarget()); ILog log = (ILog)mocks.CreateMock(typeof(ILog)); SimpleLoggingAdvice loggingAdvice = new SimpleLoggingAdvice(log); pf.AddAdvice(loggingAdvice); Expect.Call(log.IsTraceEnabled).Return(true).Repeat.Any(); log.Trace("Entering DoSomething"); log.Trace("Exiting DoSomething"); mocks.ReplayAll(); object proxy = pf.GetProxy(); ITestTarget ptt = (ITestTarget)proxy; ptt.DoSomething(); mocks.VerifyAll(); }