Beispiel #1
0
        public void ProccedAndReturnWithRuntimePolicyOff(ActionInvoker.InvokeActionMethod sut, IAlternateMethodContext context)
        {
            context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off);

            sut.NewImplementation(context);

            context.Verify(c => c.Proceed());
            context.MessageBroker.Verify(b => b.Publish(It.IsAny <ActionInvoker.InvokeActionMethod.Message>()), Times.Never());
        }
Beispiel #2
0
        public void PublishMessageWithRuntimePolicyOn(ActionInvoker.InvokeActionMethod sut, IAlternateMethodContext context)
        {
            var actionDescriptorMock = new Mock <ActionDescriptor>();

            actionDescriptorMock.Setup(a => a.ControllerDescriptor).Returns(new ReflectedControllerDescriptor(typeof(DummyController)));
            actionDescriptorMock.Setup(a => a.ActionName).Returns("Index");

            context.Setup(c => c.ReturnValue).Returns(new ContentResult());
            context.Setup(c => c.Arguments).Returns(new object[]
            {
                new ControllerContext(),
                actionDescriptorMock.Object,
                new Dictionary <string, object>()
            });

            sut.NewImplementation(context);

            context.TimerStrategy().Verify(t => t.Time(It.IsAny <Action>()));
            context.MessageBroker.Verify(b => b.Publish(It.IsAny <ActionInvoker.InvokeActionMethod.Message>()));
        }