public void modify_without_any_prior_caching() { var chain = new BehaviorChain(); CachedPartialConvention.Modify(chain); chain.Last().ShouldBeOfType <OutputCachingNode>() .VaryByPolicies().Single().ShouldEqual(typeof(VaryByResource)); }
public void modify_without_any_prior_caching() { var chain = new BehaviorChain(); CachedPartialConvention.Modify(chain); chain.Last().ShouldBeOfType<OutputCachingNode>() .VaryByPolicies().Single().ShouldEqual(typeof (VaryByResource)); }
public void modifies_a_chain() { var chain = new BehaviorChain(); var theAction = ActionCall.For<AjaxController>(x => x.get_success()); chain.AddToEnd(theAction); chain.AddToEnd(chain.Output.As<OutputNode>()); OutputBeforeAjaxContinuationPolicy.Modify(chain); chain.First().ShouldBeTheSameAs(chain.Output); chain.Last().ShouldBeTheSameAs(theAction); }
public void modifies_a_chain() { var chain = new BehaviorChain(); var theAction = ActionCall.For <AjaxController>(x => x.get_success()); chain.AddToEnd(theAction); chain.AddToEnd(chain.Output); OutputBeforeAjaxContinuationPolicy.Modify(chain); chain.First().ShouldBeTheSameAs(chain.Output); chain.Last().ShouldBeTheSameAs(theAction); }
// This should not do anything if there are conneg nodes public static void ApplyConneg(this BehaviorChain chain) { var inputType = chain.InputType(); if (chain.ConnegInputNode() == null && inputType != null) { var inputNode = new ConnegInputNode(inputType); var action = chain.FirstCall(); action.AddBefore(inputNode); } var actionOutputType = chain.ActionOutputType(); if (chain.ConnegOutputNode() == null && actionOutputType != null && actionOutputType != typeof(void) && actionOutputType != typeof(HttpStatusCode)) { var outputNode = new ConnegOutputNode(actionOutputType); var action = chain.Last(x => x is ActionCall); action.AddAfter(outputNode); } }