public void ProceedAndReturnWithRuntimePolicyOff(AsyncActionInvoker.BeginInvokeActionMethod sut, IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.Verify(c => c.Proxy, Times.Never()); }
public void ProceedWithRuntimePolicyOff(DependencyResolver.GetServices sut, IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.Verify(c => c.Arguments, Times.Never()); context.Verify(c => c.ReturnValue, Times.Never()); }
public void ProceedWithRuntimePolicyOff(DependencyResolver.GetService sut, IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.Verify(c => c.ReturnValue, Times.Never()); context.Verify(c => c.Arguments, Times.Never()); }
public void ProxyFiltersWithRuntimePolicyOn([Frozen] IExecutionTimer timer, ActionInvoker.GetFilters <T> sut, IAlternateMethodContext context) { sut.NewImplementation(context); timer.Verify(t => t.Time(It.IsAny <Action>())); context.Verify(c => c.ReturnValue); }
public void PublishMessageWithRuntimePolicyOn(AsyncActionInvoker.EndInvokeActionMethod sut, IAlternateMethodContext context, ActionDescriptor actionDescriptor) { 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.Proxy).Returns( new ActionInvokerStateMixin { Offset = TimeSpan.Zero, Arguments = new ActionInvoker.InvokeActionMethod.Arguments(new ControllerContext(), actionDescriptor, new Dictionary <string, object>()) }); context.Setup(c => c.Arguments).Returns(new object[] { new ControllerContext(), actionDescriptorMock.Object, new Dictionary <string, object>() }); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.MessageBroker.Verify(b => b.Publish(It.IsAny <ActionInvoker.InvokeActionMethod.Message>())); }
public void PublishMessageWithRuntimePolicyOn(AsyncActionInvoker.EndInvokeActionMethod sut, IAlternateMethodContext context, ActionDescriptor actionDescriptor) { 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.Proxy).Returns( new ActionInvokerStateMixin { Offset = TimeSpan.Zero, Arguments = new ActionInvoker.InvokeActionMethod.Arguments(new ControllerContext(), actionDescriptor, new Dictionary<string, object>()) }); context.Setup(c => c.Arguments).Returns(new object[] { new ControllerContext(), actionDescriptorMock.Object, new Dictionary<string, object>() }); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.MessageBroker.Verify(b => b.Publish(It.IsAny<ActionInvoker.InvokeActionMethod.Message>())); }
public void ProceedIfRuntimePolicyIsOff(ViewEngine.FindViews sut, IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); sut.NewImplementation(context); context.Verify(c => c.Proceed()); }
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()); }
public void StartTimingExecution(AsyncActionInvoker.BeginInvokeActionMethod sut, IAlternateMethodContext context, IActionInvokerStateMixin mixin) { context.Setup(c => c.Proxy).Returns(mixin); context.Setup(c => c.Arguments).Returns(new object[] { new ControllerContext(), new Mock<ActionDescriptor>().Object, new Dictionary<string, object>(), new AsyncCallback(delegate { }), "state" }); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.Verify(c => c.Proxy); mixin.VerifySet(m => m.Offset = It.IsAny<TimeSpan>()); }
public void ProceedWithOffPolicy(View.Render sut, IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.TimerStrategy().Verify(t => t.Time(It.IsAny<Action>()), Times.Never()); }
public void StartTimingExecution(AsyncActionInvoker.BeginInvokeActionMethod sut, IAlternateMethodContext context, IActionInvokerStateMixin mixin) { context.Setup(c => c.Proxy).Returns(mixin); context.Setup(c => c.Arguments).Returns(new object[] { new ControllerContext(), new Mock <ActionDescriptor>().Object, new Dictionary <string, object>(), new AsyncCallback(delegate { }), "state" }); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.Verify(c => c.Proxy); mixin.VerifySet(m => m.Offset = It.IsAny <TimeSpan>()); }
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()); }
public void ProceedAndReturnWithRuntimePolicyOff(ValueProviderFactory.GetValueProvider sut, IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.MessageBroker.Verify(mb => mb.Publish(It.IsAny<object>()), Times.Never()); }
public void ProceedImmediatlyIfRuntimePolicyOff(ControllerFactory.CreateController sut, IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.MessageBroker.Verify(mb => mb.Publish(It.IsAny <ControllerFactory.CreateController.Message>()), Times.Never()); }
public void ProceedImmediatlyIfRuntimePolicyOff(ControllerFactory.CreateController sut, IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.MessageBroker.Verify(mb => mb.Publish(It.IsAny<ControllerFactory.CreateController.Message>()), Times.Never()); }
public void ProceedWithOffPolicy(View.Render sut, IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.TimerStrategy().Verify(t => t.Time(It.IsAny <Action>()), Times.Never()); }
public void ProceedAndReturnWithRuntimePolicyOff(ModelBinderProvider.GetBinder sut, IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.MessageBroker.Verify(mb => mb.Publish(It.IsAny <object>()), Times.Never()); }
public void ReturnWhenRuntimePolicyIsOff(IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); var impl = new Route.GetRouteData(typeof(T)); impl.NewImplementation(context); context.Verify(c => c.Proceed()); }
public void ReturnWhenRuntimePolicyIsOff(IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); var impl = new RouteConstraint.Match(); impl.NewImplementation(context); context.Verify(c => c.Proceed()); }
public void ProceedWithTimerWithNullReturnValue(ValueProviderFactory.GetValueProvider sut, IAlternateMethodContext context, ControllerContext arg1) { context.Setup(c => c.Arguments).Returns(new object[] { arg1 }); context.Setup(c => c.ReturnValue).Returns(null); sut.NewImplementation(context); context.TimerStrategy().Verify(c => c.Time(It.IsAny<Action>())); context.Verify(c => c.ReturnValue); }
public void ProceedWithTimerWithNullReturnValue(ValueProviderFactory.GetValueProvider sut, IAlternateMethodContext context, ControllerContext arg1) { context.Setup(c => c.Arguments).Returns(new object[] { arg1 }); context.Setup(c => c.ReturnValue).Returns(null); sut.NewImplementation(context); context.TimerStrategy().Verify(c => c.Time(It.IsAny <Action>())); context.Verify(c => c.ReturnValue); }
public void ReturnWhenRuntimePolicyIsOff(IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); var impl = new ActionFilter.OnActionExecuted(); impl.NewImplementation(context); context.Verify(c => c.Proceed()); }
public void ReturnWhenRuntimePolicyIsOff(IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); var impl = new ActionFilter.OnActionExecuting(); impl.NewImplementation(context); context.Verify(c => c.Proceed()); }
public void ProceedAndReturnWithRuntimePolicyOff(IAlternateMethodContext context) { context.Setup(c => c.RuntimePolicyStrategy).Returns(() => RuntimePolicy.Off); var sut = new AuthorizationFilter.OnAuthorization(); sut.NewImplementation(context); context.Verify(c => c.Proceed()); context.MessageBroker.Verify(mb => mb.Publish(It.IsAny<MessageBase>()), Times.Never()); }
public void ProceedAndWarnWithRuntimePolicyOnAndIModelBinder(AlternateType<IModelBinder> alternateModelBinder, IAlternateMethodContext context, Type arg1, IModelBinder returnValue) { context.Setup(c => c.Arguments).Returns(new object[] { arg1 }); context.Setup(c => c.ReturnValue).Returns(returnValue); var sut = new ModelBinderProvider.GetBinder(alternateModelBinder); sut.NewImplementation(context); context.TimerStrategy().Verify(t => t.Time(It.IsAny<Action>())); context.Verify(mb => mb.ReturnValue); }
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()); }
public void ProceedAndWarnWithRuntimePolicyOnAndIModelBinder(AlternateType <IModelBinder> alternateModelBinder, IAlternateMethodContext context, Type arg1, IModelBinder returnValue) { context.Setup(c => c.Arguments).Returns(new object[] { arg1 }); context.Setup(c => c.ReturnValue).Returns(returnValue); var sut = new ModelBinderProvider.GetBinder(alternateModelBinder); sut.NewImplementation(context); context.TimerStrategy().Verify(t => t.Time(It.IsAny <Action>())); context.Verify(mb => mb.ReturnValue); }
public void ProceedWithTimerWithIValueProviderReturnValue([Frozen] IProxyFactory proxyFactory, ValueProviderFactory.GetValueProvider sut, IAlternateMethodContext context, ControllerContext arg1, IValueProvider returnValue) { context.Setup(c => c.Arguments).Returns(new object[] { arg1 }); context.Setup(c => c.ReturnValue).Returns(returnValue); proxyFactory.Setup(pf => pf.IsWrapInterfaceEligible <IValueProvider>(typeof(IValueProvider))).Returns(true); proxyFactory.Setup(pf => pf.WrapInterface(It.IsAny <IValueProvider>(), It.IsAny <IEnumerable <IAlternateMethod> >())).Returns(returnValue); sut.NewImplementation(context); context.TimerStrategy().Verify(c => c.Time(It.IsAny <Action>())); context.Verify(c => c.ReturnValue); context.VerifySet(c => c.ReturnValue = It.IsAny <IValueProvider>()); }
public void ProceedWithTimerWithIValueProviderReturnValue([Frozen] IProxyFactory proxyFactory, ValueProviderFactory.GetValueProvider sut, IAlternateMethodContext context, ControllerContext arg1, IValueProvider returnValue) { context.Setup(c => c.Arguments).Returns(new object[] { arg1 }); context.Setup(c => c.ReturnValue).Returns(returnValue); proxyFactory.Setup(pf => pf.IsWrapInterfaceEligible<IValueProvider>(typeof(IValueProvider))).Returns(true); proxyFactory.Setup(pf => pf.WrapInterface(It.IsAny<IValueProvider>(), It.IsAny<IEnumerable<IAlternateMethod>>())).Returns(returnValue); sut.NewImplementation(context); context.TimerStrategy().Verify(c => c.Time(It.IsAny<Action>())); context.Verify(c => c.ReturnValue); context.VerifySet(c => c.ReturnValue = It.IsAny<IValueProvider>()); }
public void ProceedAndWrapResultWithRuntimePolicyOnAndDefaultModelBinder(AlternateType<IModelBinder> alternateModelBinder, IAlternateMethodContext context, Type arg1, DefaultModelBinder returnValue, IModelBinder newModelBinder) { context.Setup(c => c.Arguments).Returns(new object[] { arg1 }); context.Setup(c => c.ReturnValue).Returns(returnValue); alternateModelBinder.Setup(amb => amb.TryCreate(It.IsAny<IModelBinder>(), out newModelBinder, null, null)).Returns(true); var sut = new ModelBinderProvider.GetBinder(alternateModelBinder); sut.NewImplementation(context); context.TimerStrategy().Verify(t => t.Time(It.IsAny<Action>())); context.Verify(mb => mb.ReturnValue); context.Logger.Verify(l => l.Warn(It.IsAny<string>(), context.ReturnValue.GetType()), Times.Never()); context.VerifySet(c => c.ReturnValue = newModelBinder); alternateModelBinder.Verify(amb => amb.TryCreate(It.IsAny<IModelBinder>(), out newModelBinder, null, null)); }
public void ProceedAndWrapResultWithRuntimePolicyOnAndDefaultModelBinder(AlternateType <IModelBinder> alternateModelBinder, IAlternateMethodContext context, Type arg1, DefaultModelBinder returnValue, IModelBinder newModelBinder) { context.Setup(c => c.Arguments).Returns(new object[] { arg1 }); context.Setup(c => c.ReturnValue).Returns(returnValue); alternateModelBinder.Setup(amb => amb.TryCreate(It.IsAny <IModelBinder>(), out newModelBinder, null, null)).Returns(true); var sut = new ModelBinderProvider.GetBinder(alternateModelBinder); sut.NewImplementation(context); context.TimerStrategy().Verify(t => t.Time(It.IsAny <Action>())); context.Verify(mb => mb.ReturnValue); context.Logger.Verify(l => l.Warn(It.IsAny <string>(), context.ReturnValue.GetType()), Times.Never()); context.VerifySet(c => c.ReturnValue = newModelBinder); alternateModelBinder.Verify(amb => amb.TryCreate(It.IsAny <IModelBinder>(), out newModelBinder, null, null)); }