コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }