public override void Given() { Selector = CreateStub <ActionResultSelector>(); actionResultResolver = new FluentMvcResolver(actionResultRegistry, CreateStub <IFluentMvcObjectFactory>(), new ActionFilterResolver(actionFilterRegistry, CreateStub <IFluentMvcObjectFactory>())); CatchAllFactory = CreateStub <IActionResultFactory>(); actionResultResolver.SetDefaultFactory(CatchAllFactory); }
public ActionResultFactoryTester(string[] acceptTypes, object returnValue) { factoryOptions = new ActionResultSelector { AcceptTypes = acceptTypes, ReturnValue = returnValue, ControllerContext = new ControllerContext() }; ReturnValue = returnValue; Child = new TFilter(); }
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); }
protected override bool ShouldBeReturnedForCore(ActionResultSelector selector) { return selector.ReturnValue != null && typeof(ActionResult).IsAssignableFrom(selector.ReturnValue.GetType()); }
protected override bool ShouldBeReturnedForCore(ActionResultSelector selector) { return(selector.ReturnValue != null && typeof(ActionResult).IsAssignableFrom(selector.ReturnValue.GetType())); }
public ActionResult Create(ActionResultSelector selector) { return(new EmptyResult()); }
public virtual ActionResult Create(ActionResultSelector selector) { return(CreateCore(selector)); }
private bool IsConstraintSatisfied(ActionResultSelector selector) { return(constaints.HasItems() && constaints.Any(x => x.IsSatisfiedBy(selector))); }
public ActionResult Create(ActionResultSelector selector) { var factory = pipeline.FirstOrDefault(x => x.ShouldBeReturnedFor(selector)); return factory != null ? factory.Create(selector) : null; }
protected override ActionResult CreateCore(ActionResultSelector selector) { return new JsonResult {Data = selector.ReturnValue}; }
public virtual ActionResult Create(ActionResultSelector selector) { return CreateCore(selector); }
protected virtual bool ShouldBeReturnedForCore(ActionResultSelector selector) { return false; }
private bool IsConstraintSatisfied(ActionResultSelector selector) { return constaints.HasItems() && constaints.Any(x => x.IsSatisfiedBy(selector)); }
public virtual bool ShouldBeReturnedFor(ActionResultSelector selector) { return IsConstraintSatisfied(selector) || ShouldBeReturnedForCore(selector); }
public ActionResult Create(ActionResultSelector selector) { var factory = pipeline.FirstOrDefault(x => x.ShouldBeReturnedFor(selector)); return(factory != null?factory.Create(selector) : null); }
protected override ActionResult CreateCore(ActionResultSelector selector) { return new ViewResult { ViewData = selector.ViewData }; }
protected abstract ActionResult CreateCore(ActionResultSelector selector);
protected override ActionResult CreateCore(ActionResultSelector selector) { return new JsonResult { Data = selector.ViewData.Model }; }
public ActionResult Create(ActionResultSelector selector) { return new EmptyResult(); }
public virtual bool ShouldBeReturnedFor(ActionResultSelector selector) { return(IsConstraintSatisfied(selector) || ShouldBeReturnedForCore(selector)); }
public bool ShouldBeReturnedFor(ActionResultSelector selector) { return false; }
protected virtual bool ShouldBeReturnedForCore(ActionResultSelector selector) { return(false); }
protected override ActionResult CreateCore(ActionResultSelector selector) { throw new Exception("ErrorThrowingResultFactory"); }
public bool ShouldBeReturnedFor(ActionResultSelector selector) { return(selector.AcceptTypes.Contains("accept")); }
public bool ShouldBeReturnedFor(ActionResultSelector selector) { return(false); }
protected override ActionResult CreateCore(ActionResultSelector selector) { return(new JsonResult { Data = selector.ReturnValue }); }
protected override ActionResult CreateCore(ActionResultSelector selector) { return(selector.ReturnValue as ActionResult); }
protected override ActionResult CreateCore(ActionResultSelector selector) { return(new JsonResult { Data = selector.ViewData.Model }); }
protected override ActionResult CreateCore(ActionResultSelector selector) { return selector.ReturnValue as ActionResult; }
protected override ActionResult CreateCore(ActionResultSelector selector) { return(new ViewResult { ViewData = selector.ViewData }); }