コード例 #1
0
        public void ProceedAndPublishMessagesWithRuntimePolicyOn(ResultExecutedContext argument, IAlternateMethodContext context)
        {
            context.Setup(c => c.Arguments).Returns(new object[] { argument });

            var sut = new ResultFilter.OnResultExecuted();
            sut.NewImplementation(context);

            context.TimerStrategy().Verify(t => t.Time(It.IsAny<Action>()));
            context.MessageBroker.Verify(mb => mb.Publish(It.IsAny<ResultFilter.OnResultExecuted.Message>()));
        }
コード例 #2
0
        public void ProceedAndReturnWithRuntimePolicyOff(IAlternateMethodContext context)
        {
            context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off);

            var sut = new ResultFilter.OnResultExecuted();
            sut.NewImplementation(context);

            context.Verify(c => c.Proceed());
            context.MessageBroker.Verify(mb => mb.Publish(It.IsAny<MessageBase>()), Times.Never());
        }
コード例 #3
0
        public void ProceedAndPublishMessagesWithRuntimePolicyOn(ResultExecutedContext argument, IAlternateMethodContext context)
        {
            context.Setup(c => c.Arguments).Returns(new object[] { argument });

            var sut = new ResultFilter.OnResultExecuted();

            sut.NewImplementation(context);

            context.TimerStrategy().Verify(t => t.Time(It.IsAny <Action>()));
            context.MessageBroker.Verify(mb => mb.Publish(It.IsAny <ResultFilter.OnResultExecuted.Message>()));
        }
コード例 #4
0
        public void ProceedAndReturnWithRuntimePolicyOff(IAlternateMethodContext context)
        {
            context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off);

            var sut = new ResultFilter.OnResultExecuted();

            sut.NewImplementation(context);

            context.Verify(c => c.Proceed());
            context.MessageBroker.Verify(mb => mb.Publish(It.IsAny <MessageBase>()), Times.Never());
        }
コード例 #5
0
        public void ImplementProperMethod()
        {
            var sut = new ResultFilter.OnResultExecuted();

            Assert.Equal("OnResultExecuted", sut.MethodToImplement.Name);
        }
コード例 #6
0
        public void ImplementProperMethod()
        {
            var sut = new ResultFilter.OnResultExecuted();

            Assert.Equal("OnResultExecuted", sut.MethodToImplement.Name);
        }