public override void Given() { var fluentMvcObjectFactory = CreateStub <IFluentMvcObjectFactory>(); fluentMvcObjectFactory.Stub(x => x.Resolve <object>(Arg <Type> .Is.Anything)).Return(new TestFilter()); actionFilterRegistry = new ActionFilterRegistry(fluentMvcObjectFactory); globalFilter = new GlobalActionFilterRegistryItem(typeof(TestActionFilter), PredefinedConstraint.True); Expression <Func <TestController, object> > func = c => c.ReturnPost(); actionDescriptor = func.CreateActionDescriptor(); controllerFilterItem = new ControllerRegistryItem(typeof(TestActionFilter3), PredefinedConstraint.True, actionDescriptor.ControllerDescriptor); controllerActionFilterItem = new ControllerActionRegistryItem(typeof(TestActionFilter2), PredefinedConstraint.True, actionDescriptor, actionDescriptor.ControllerDescriptor); actionFilterRegistry.Add(globalFilter); actionFilterRegistry.Add(controllerFilterItem); actionFilterRegistry.Add(controllerActionFilterItem); resolver = new ActionFilterResolver(actionFilterRegistry, fluentMvcObjectFactory); }
public override void Given() { var fluentMvcObjectFactory = CreateStub<IFluentMvcObjectFactory>(); fluentMvcObjectFactory.Stub(x => x.Resolve<object>(Arg<Type>.Is.Anything)).Return(new TestFilter()); actionFilterRegistry = new ActionFilterRegistry(fluentMvcObjectFactory); globalFilter = new GlobalActionFilterRegistryItem(typeof(TestActionFilter), PredefinedConstraint.True); Expression<Func<TestController, object>> func = c => c.ReturnPost(); actionDescriptor = func.CreateActionDescriptor(); controllerFilterItem = new ControllerRegistryItem(typeof(TestActionFilter3), PredefinedConstraint.True, actionDescriptor.ControllerDescriptor); controllerActionFilterItem = new ControllerActionRegistryItem(typeof(TestActionFilter2), PredefinedConstraint.True, actionDescriptor, actionDescriptor.ControllerDescriptor); actionFilterRegistry.Add(globalFilter); actionFilterRegistry.Add(controllerFilterItem); actionFilterRegistry.Add(controllerActionFilterItem); resolver = new ActionFilterResolver(actionFilterRegistry, fluentMvcObjectFactory); }