コード例 #1
0
 public override void Given()
 {
     Selector             = CreateStub <ActionResultSelector>();
     actionResultResolver = new FluentMvcResolver(actionResultRegistry, CreateStub <IFluentMvcObjectFactory>(), new ActionFilterResolver(actionFilterRegistry, CreateStub <IFluentMvcObjectFactory>()));
     CatchAllFactory      = CreateStub <IActionResultFactory>();
     actionResultResolver.SetDefaultFactory(CatchAllFactory);
 }
コード例 #2
0
 public ActionResultFactoryTester(string[] acceptTypes, object returnValue)
 {
     factoryOptions = new ActionResultSelector {
         AcceptTypes = acceptTypes, ReturnValue = returnValue, ControllerContext = new ControllerContext()
     };
     ReturnValue = returnValue;
     Child       = new TFilter();
 }
コード例 #3
0
        public override void Given()
        {
            pipeline = CreateStub <IActionResultPipeline>();

            ExpectedActionResult = CreateStub <ActionResult>();
            pipeline.Stub(factory => factory.Create(Arg <ActionResultSelector> .Is.Anything))
            .Return(ExpectedActionResult);

            FactoryOptions       = CreateStub <ActionResultSelector>();
            actionResultResolver = new FluentMvcResolver(actionResultRegistry, CreateStub <IFluentMvcObjectFactory>(), new ActionFilterResolver(actionFilterRegistry, CreateStub <IFluentMvcObjectFactory>()));
            actionResultResolver.RegisterActionResultPipeline(pipeline);
        }
コード例 #4
0
 protected override bool ShouldBeReturnedForCore(ActionResultSelector selector)
 {
     return selector.ReturnValue != null && typeof(ActionResult).IsAssignableFrom(selector.ReturnValue.GetType());
 }
コード例 #5
0
 protected override bool ShouldBeReturnedForCore(ActionResultSelector selector)
 {
     return(selector.ReturnValue != null && typeof(ActionResult).IsAssignableFrom(selector.ReturnValue.GetType()));
 }
コード例 #6
0
 public ActionResult Create(ActionResultSelector selector)
 {
     return(new EmptyResult());
 }
コード例 #7
0
 public virtual ActionResult Create(ActionResultSelector selector)
 {
     return(CreateCore(selector));
 }
コード例 #8
0
 private bool IsConstraintSatisfied(ActionResultSelector selector)
 {
     return(constaints.HasItems() && constaints.Any(x => x.IsSatisfiedBy(selector)));
 }
コード例 #9
0
        public ActionResult Create(ActionResultSelector selector)
        {
            var factory = pipeline.FirstOrDefault(x => x.ShouldBeReturnedFor(selector));

            return factory != null ? factory.Create(selector) : null;
        }
コード例 #10
0
 protected override ActionResult CreateCore(ActionResultSelector selector)
 {
     return new JsonResult {Data = selector.ReturnValue};
 }
コード例 #11
0
 public virtual ActionResult Create(ActionResultSelector selector)
 {
     return CreateCore(selector);
 }
コード例 #12
0
 protected virtual bool ShouldBeReturnedForCore(ActionResultSelector selector)
 {
     return false;
 }
コード例 #13
0
 private bool IsConstraintSatisfied(ActionResultSelector selector)
 {
     return constaints.HasItems() && constaints.Any(x => x.IsSatisfiedBy(selector));
 }
コード例 #14
0
 public virtual bool ShouldBeReturnedFor(ActionResultSelector selector)
 {
     return IsConstraintSatisfied(selector) || ShouldBeReturnedForCore(selector);
 }
コード例 #15
0
        public ActionResult Create(ActionResultSelector selector)
        {
            var factory = pipeline.FirstOrDefault(x => x.ShouldBeReturnedFor(selector));

            return(factory != null?factory.Create(selector) : null);
        }
コード例 #16
0
 protected override ActionResult CreateCore(ActionResultSelector selector)
 {
     return new ViewResult { ViewData = selector.ViewData };
 }
コード例 #17
0
 protected abstract ActionResult CreateCore(ActionResultSelector selector);
コード例 #18
0
 protected override ActionResult CreateCore(ActionResultSelector selector)
 {
     return new JsonResult { Data = selector.ViewData.Model };
 }
コード例 #19
0
 public ActionResult Create(ActionResultSelector selector)
 {
     return new EmptyResult();
 }
コード例 #20
0
 public virtual bool ShouldBeReturnedFor(ActionResultSelector selector)
 {
     return(IsConstraintSatisfied(selector) || ShouldBeReturnedForCore(selector));
 }
コード例 #21
0
 public bool ShouldBeReturnedFor(ActionResultSelector selector)
 {
     return false;
 }
コード例 #22
0
 protected virtual bool ShouldBeReturnedForCore(ActionResultSelector selector)
 {
     return(false);
 }
コード例 #23
0
 protected override ActionResult CreateCore(ActionResultSelector selector)
 {
     throw new Exception("ErrorThrowingResultFactory");
 }
コード例 #24
0
 protected abstract ActionResult CreateCore(ActionResultSelector selector);
コード例 #25
0
 public bool ShouldBeReturnedFor(ActionResultSelector selector)
 {
     return(selector.AcceptTypes.Contains("accept"));
 }
コード例 #26
0
 public bool ShouldBeReturnedFor(ActionResultSelector selector)
 {
     return(false);
 }
コード例 #27
0
ファイル: JsonResultFactory.cs プロジェクト: carcer/FluentMvc
 protected override ActionResult CreateCore(ActionResultSelector selector)
 {
     return(new JsonResult {
         Data = selector.ReturnValue
     });
 }
コード例 #28
0
 protected override ActionResult CreateCore(ActionResultSelector selector)
 {
     return(selector.ReturnValue as ActionResult);
 }
コード例 #29
0
ファイル: JsonResultFactory.cs プロジェクト: carcer/FluentMvc
 protected override ActionResult CreateCore(ActionResultSelector selector)
 {
     return(new JsonResult {
         Data = selector.ViewData.Model
     });
 }
コード例 #30
0
 protected override ActionResult CreateCore(ActionResultSelector selector)
 {
     return selector.ReturnValue as ActionResult;
 }
コード例 #31
0
 protected override ActionResult CreateCore(ActionResultSelector selector)
 {
     return(new ViewResult {
         ViewData = selector.ViewData
     });
 }