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)); }
public void PublishMessagesIfRuntimePolicyIsOnAndViewIsFound([Frozen] IProxyFactory proxyFactory, ViewEngine.FindViews sut, IAlternateMethodContext context, IView view, IViewEngine engine, ControllerContext controllerContext) { context.Setup(c => c.Arguments).Returns(GetArguments(controllerContext)); context.Setup(c => c.ReturnValue).Returns(new ViewEngineResult(view, engine)); context.Setup(c => c.TargetType).Returns(typeof(int)); proxyFactory.Setup(p => p.IsWrapInterfaceEligible <IView>(It.IsAny <Type>())).Returns(true); proxyFactory.Setup(p => p.WrapInterface( It.IsAny <IView>(), It.IsAny <IEnumerable <IAlternateMethod> >(), It.IsAny <IEnumerable <object> >())) .Returns(view); sut.NewImplementation(context); proxyFactory.Verify(p => p.IsWrapInterfaceEligible <IView>(It.IsAny <Type>())); context.Logger.Verify(l => l.Info(It.IsAny <string>(), It.IsAny <object[]>())); context.VerifySet(c => c.ReturnValue = It.IsAny <ViewEngineResult>()); context.MessageBroker.Verify(b => b.Publish(It.IsAny <ViewEngine.FindViews.Message>())); }
public void PublishMessagesIfRuntimePolicyIsOnAndViewIsFound([Frozen] IProxyFactory proxyFactory, ViewEngine.FindViews sut, IAlternateMethodContext context, IView view, IViewEngine engine, ControllerContext controllerContext) { context.Setup(c => c.Arguments).Returns(GetArguments(controllerContext)); context.Setup(c => c.ReturnValue).Returns(new ViewEngineResult(view, engine)); context.Setup(c => c.TargetType).Returns(typeof(int)); proxyFactory.Setup(p => p.IsWrapInterfaceEligible<IView>(It.IsAny<Type>())).Returns(true); proxyFactory.Setup(p => p.WrapInterface( It.IsAny<IView>(), It.IsAny<IEnumerable<IAlternateMethod>>(), It.IsAny<IEnumerable<object>>())) .Returns(view); sut.NewImplementation(context); proxyFactory.Verify(p => p.IsWrapInterfaceEligible<IView>(It.IsAny<Type>())); context.Logger.Verify(l => l.Info(It.IsAny<string>(), It.IsAny<object[]>())); context.VerifySet(c => c.ReturnValue = It.IsAny<ViewEngineResult>()); context.MessageBroker.Verify(b => b.Publish(It.IsAny<ViewEngine.FindViews.Message>())); }