public override void Given()
        {
            actionFilter  = new TestActionFilter();
            objectFactory = CreateStub <IFluentMvcObjectFactory>();
            objectFactory.Stub(of => of.Resolve <IActionFilter>(Arg <Type> .Is.Anything))
            .Return(actionFilter);

            actionFilterRegistry       = new ActionFilterRegistry(objectFactory);
            actionFilterRegistryTester = new ActionFilterRegistryTester(actionFilterRegistry);
        }
        public override void Given()
        {
            actionFilter = new TestActionFilter();
            objectFactory = CreateStub<IFluentMvcObjectFactory>();
            objectFactory.Stub(of => of.Resolve<IActionFilter>(Arg<Type>.Is.Anything))
                .Return(actionFilter);

            actionFilterRegistry = new ActionFilterRegistry(objectFactory);
            actionFilterRegistryTester = new ActionFilterRegistryTester(actionFilterRegistry);
        }
        public override void Given()
        {
            Expression <Func <TestController, object> >       func  = c => c.ReturnPost();
            Expression <Func <SecondTestController, object> > func2 = c => c.ReturnPost();
            Expression <Func <ThirdTestController, object> >  func3 = c => c.ReturnPost();

            actionDescriptor         = func.CreateActionDescriptor();
            secondActionDescriptor   = func2.CreateActionDescriptor();
            excludedActionDescriptor = func3.CreateActionDescriptor();

            fluentMvcObjectFactory = CreateStub <IFluentMvcObjectFactory>();
            fluentMvcObjectFactory.Stub(x => x.Resolve <object>(Arg <Type> .Is.Anything)).Return(CreateStub <IActionFilter>());

            actionFilterRegistry = new ActionFilterRegistry(fluentMvcObjectFactory);
            Configuration        = FluentMvcConfiguration.Create(CreateStub <IFluentMvcResolver>(), actionFilterRegistry, CreateStub <IActionResultRegistry>(), CreateStub <IFilterConventionCollection>())
                                   .WithFilter <AcceptVerbsAttribute>()
                                   .WithFilter <AuthorizeAttribute>(Except.For <TestController>().AndFor(func3));

            resolver = new ActionFilterResolver(actionFilterRegistry, fluentMvcObjectFactory);
        }
        public override void Because()
        {
            actionFilter = new TestActionFilter();
            objectFactory = CreateStub<IFluentMvcObjectFactory>();
            objectFactory.Stub(of => of.Resolve<IActionFilter>(Arg<Type>.Is.Anything))
                .Return(actionFilter).Repeat.Any();

            actionFilterRegistry = new ActionFilterRegistry(objectFactory);

            func = c => c.ReturnPost();

            var config = FluentMvcConfiguration.Create(CreateStub<IFluentMvcResolver>(), actionFilterRegistry, CreateStub<IActionResultRegistry>(), CreateStub<IFilterConventionCollection>());

            config.ExposeConfiguration(x =>
                                           {
                                               x.WithFilter<TestActionFilter>(Except.For<ThirdTestController>());

                                               x.WithFilter<TestActionFilter>(Apply.For<TestController>().AndFor<SecondTestController>());
                                           });

            config.BuildFilterProvider();
        }
        public override void Because()
        {
            actionFilter  = new TestActionFilter();
            objectFactory = CreateStub <IFluentMvcObjectFactory>();
            objectFactory.Stub(of => of.Resolve <IActionFilter>(Arg <Type> .Is.Anything))
            .Return(actionFilter).Repeat.Any();

            actionFilterRegistry = new ActionFilterRegistry(objectFactory);

            func = c => c.ReturnPost();

            var config = FluentMvcConfiguration.Create(CreateStub <IFluentMvcResolver>(), actionFilterRegistry, CreateStub <IActionResultRegistry>(), CreateStub <IFilterConventionCollection>());

            config.ExposeConfiguration(x =>
            {
                x.WithFilter <TestActionFilter>(Except.For <ThirdTestController>());

                x.WithFilter <TestActionFilter>(Apply.For <TestController>().AndFor <SecondTestController>());
            });

            config.BuildFilterProvider();
        }
 public override void Because()
 {
     factory = CreateStub<IFluentMvcObjectFactory>();
     factory.Stub(x => x.CreateConstraint(Arg<Type>.Is.Anything)).Return(CreateStub<IConstraint>()).Repeat.
         Any();
 }
Esempio n. 7
0
 public override void Because()
 {
     factory = CreateStub <IFluentMvcObjectFactory>();
     factory.Stub(x => x.CreateConstraint(Arg <Type> .Is.Anything)).Return(CreateStub <IConstraint>()).Repeat.
     Any();
 }
Esempio n. 8
0
        public override void Given()
        {
            Expression<Func<TestController, object>> func = c => c.ReturnPost();
            Expression<Func<SecondTestController, object>> func2 = c => c.ReturnPost();
            Expression<Func<ThirdTestController, object>> func3 = c => c.ReturnPost();
            actionDescriptor = func.CreateActionDescriptor();
            secondActionDescriptor = func2.CreateActionDescriptor();
            excludedActionDescriptor = func3.CreateActionDescriptor();

            fluentMvcObjectFactory = CreateStub<IFluentMvcObjectFactory>();
            fluentMvcObjectFactory.Stub(x => x.Resolve<object>(Arg<Type>.Is.Anything)).Return(CreateStub<IActionFilter>());

            actionFilterRegistry = new ActionFilterRegistry(fluentMvcObjectFactory);
            Configuration = FluentMvcConfiguration.Create(CreateStub<IFluentMvcResolver>(), actionFilterRegistry, CreateStub<IActionResultRegistry>(), CreateStub<IFilterConventionCollection>())
                .WithFilter<AcceptVerbsAttribute>()
                .WithFilter<AuthorizeAttribute>(Except.For<TestController>().AndFor(func3));

            resolver = new ActionFilterResolver(actionFilterRegistry, fluentMvcObjectFactory);
        }