public void calls_finds_all_calls_underneath_the_chain() { var chain = new BehaviorChain(); ActionCall call = ActionCall.For<TestController>(x => x.AnotherAction(null)); ActionCall call2 = ActionCall.For<TestController>(x => x.AnotherAction(null)); chain.Append(call); chain.Append(call2); chain.Calls.Count().ShouldEqual(2); chain.Calls.Contains(call).ShouldBeTrue(); chain.Calls.Contains(call2).ShouldBeTrue(); }
public void write_with_multiple_outputs() { var chain = new BehaviorChain(); var json = new RenderJsonNode(typeof (RouteInput)); chain.Append(json); var text = new RenderTextNode<RouteInput>(); chain.Append(text); var tag = new HtmlTag("td"); var column = new OutputColumn(); column.WriteBody(chain, tag); tag.Text().ShouldEqual(json.Description + ", " + text.Description); }
public void write_body_cell_with_multiple_calls() { var chain = new BehaviorChain(); ActionCall call1 = ActionCall.For<TargetController>(x => x.Go()); chain.Append(call1); ActionCall call2 = ActionCall.For<TargetController>(x => x.GoWithInput(null)); chain.Append(call2); var column = new ActionColumn(); var tag = new HtmlTag("td"); column.WriteBody(chain, tag); tag.Text().ShouldEqual(call1.Description + ", " + call2.Description); }
public void append_with_no_behaviors() { var chain = new BehaviorChain(); var wrapper = new Wrapper(typeof (ObjectDefInstanceTester.FakeJsonBehavior)); chain.Append(wrapper); chain.Top.ShouldBeTheSameAs(wrapper); }
public void write_body_for_chain_with_input_type() { var chain = new BehaviorChain(); chain.Append(ActionCall.For<ControllerTarget>(x => x.OneInOneOut(null))); var tag = new HtmlTag("td"); new InputModelColumn().WriteBody(chain, tag); tag.Text().ShouldEqual(typeof (Model1).Name); tag.Title().ShouldEqual(typeof (Model1).AssemblyQualifiedName); }
public void prepend_with_an_existing_top_behavior() { var chain = new BehaviorChain(); ActionCall call = ActionCall.For<TestController>(x => x.AnotherAction(null)); chain.Append(call); var wrapper = new Wrapper(typeof (ObjectDefInstanceTester.FakeJsonBehavior)); chain.Prepend(wrapper); chain.Top.ShouldBeTheSameAs(wrapper); wrapper.Next.ShouldBeTheSameAs(call); }
public void has_input() { var chain = new BehaviorChain(); chain.HasInput().ShouldBeFalse(); chain.Append(ActionCall.For<ControllerTarget>(x => x.ZeroInOneOut())); chain.HasInput().ShouldBeFalse(); chain = new BehaviorChain(); chain.Append(ActionCall.For<ControllerTarget>(x => x.OneInOneOut(null))); chain.HasInput().ShouldBeTrue(); }
public void write_with_a_single_output() { var chain = new BehaviorChain(); var node = new RenderJsonNode(typeof (RouteInput)); chain.Append(node); var tag = new HtmlTag("td"); var column = new OutputColumn(); column.WriteBody(chain, tag); tag.Text().ShouldEqual(node.Description); }
public void write_body_cell_with_only_one_call() { var chain = new BehaviorChain(); ActionCall call = ActionCall.For<TargetController>(x => x.Go()); chain.Append(call); var column = new ActionColumn(); var tag = new HtmlTag("td"); column.WriteBody(chain, tag); tag.Text().ShouldEqual(call.Description); }
public void insert_before_on_a_node() { var chain = new BehaviorChain(); var wrapper = new Wrapper(typeof (ObjectDefInstanceTester.FakeJsonBehavior)); chain.Append(wrapper); var wrapper2 = new Wrapper(typeof (ObjectDefInstanceTester.FakeJsonBehavior)); wrapper.InsertDirectlyBefore(wrapper2); chain.Top.ShouldBeTheSameAs(wrapper2); wrapper2.Next.ShouldBeTheSameAs(wrapper); wrapper2.Previous.ShouldBeTheSameAs(chain); wrapper.Previous.ShouldBeTheSameAs(wrapper2); }
public void setting_next_on_a_node_also_sets_the_previous() { var chain = new BehaviorChain(); var wrapper = new Wrapper(typeof (ObjectDefInstanceTester.FakeJsonBehavior)); chain.Append(wrapper); wrapper.Previous.ShouldBeTheSameAs(chain); var wrapper2 = new Wrapper(typeof (ObjectDefInstanceTester.FakeJsonBehavior)); wrapper.Append(wrapper2); wrapper2.Previous.ShouldBeTheSameAs(wrapper); wrapper.Previous.ShouldBeTheSameAs(chain); }
public void the_unique_id_of_the_behavior_chain_matches_the_object_def_name() { var chain = new BehaviorChain(); ActionCall call = ActionCall.For<TestController>(x => x.AnotherAction(null)); chain.Append(call); chain.UniqueId.ToString().ShouldEqual(chain.ToObjectDef().Name); }
private void registerBehavior(ActionCall call) { var chain = new BehaviorChain(); chain.Append(call); _graph.AddChain(chain); }