public void TestIntercept() { var myInterceptor = new MyInterceptor(); var invocationMock = new Mock<IInvocation>(); invocationMock.Setup(i => i.Method.Name).Returns("MyMethod"); var invocation = invocationMock.Object; myInterceptor.Intercept(invocation); Assert.IsTrue(Log.Messages.Contains("Before " + invocation.Method.Name)); Assert.IsTrue(Log.Messages.Contains("After " + invocation.Method.Name)); }
public void TestIntercept() { var myInterceptor = new MyInterceptor(); var invocationMock = new Mock <IInvocation>(); invocationMock.Setup(i => i.Method.Name).Returns("MyMethod"); var invocation = invocationMock.Object; myInterceptor.Intercept(invocation); Assert.IsTrue(Log.Messages.Contains("Before " + invocation.Method.Name)); Assert.IsTrue(Log.Messages.Contains("After " + invocation.Method.Name)); }