public void CallInvocationsProceedMethod_WhenMethodIsCalled() { // arrange var invocation = new Mock <IInvocation>(); var logger = new Mock <ILogger>(); var fakeCommand = new FakeCommand(); invocation.Setup(x => x.Request.Target).Returns(fakeCommand); var userLoggerInterceptor = new UserLoggerInterceptor(logger.Object); // act userLoggerInterceptor.Intercept(invocation.Object); // assert invocation.Verify(x => x.Proceed(), Times.Once); }
public void CallLoggersLogMethodWithTheInterceptedClassName_WhenMethodCalled() { // arrange var invocation = new Mock <IInvocation>(); var logger = new Mock <ILogger>(); var fakeCommand = new FakeCommand(); invocation.Setup(x => x.Request.Target).Returns(fakeCommand); var userLoggerInterceptor = new UserLoggerInterceptor(logger.Object); // act userLoggerInterceptor.Intercept(invocation.Object); // assert logger.Verify(x => x.Log("Fake"), Times.Once); }