public void ProceedAndPublishMessageWithRuntimePolicyOn(ResultExecutingContext argument, IAlternateMethodContext context)
        {
            context.Setup(c => c.Arguments).Returns(new object[] { argument });

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

            context.TimerStrategy().Verify(t => t.Time(It.IsAny<Action>()));
            context.MessageBroker.Verify(mb => mb.Publish(It.IsAny<ResultFilter.OnResultExecuting.Message>()));
        }
        public void ProceedAndReturnWithRuntimePolicyOff(IAlternateMethodContext context)
        {
            context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off);

            var sut = new ResultFilter.OnResultExecuting();
            sut.NewImplementation(context);
            
            context.Verify(c => c.Proceed());
            context.MessageBroker.Verify(mb => mb.Publish(It.IsAny<MessageBase>()), Times.Never());
        }
Exemplo n.º 3
0
        public void ProceedAndPublishMessageWithRuntimePolicyOn(ResultExecutingContext argument, IAlternateMethodContext context)
        {
            context.Setup(c => c.Arguments).Returns(new object[] { argument });

            var sut = new ResultFilter.OnResultExecuting();

            sut.NewImplementation(context);

            context.TimerStrategy().Verify(t => t.Time(It.IsAny <Action>()));
            context.MessageBroker.Verify(mb => mb.Publish(It.IsAny <ResultFilter.OnResultExecuting.Message>()));
        }
Exemplo n.º 4
0
        public void ProceedAndReturnWithRuntimePolicyOff(IAlternateMethodContext context)
        {
            context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off);

            var sut = new ResultFilter.OnResultExecuting();

            sut.NewImplementation(context);

            context.Verify(c => c.Proceed());
            context.MessageBroker.Verify(mb => mb.Publish(It.IsAny <MessageBase>()), Times.Never());
        }