Пример #1
0
        public void mandatory_cells_should_always_be_shown_even_if_a_value_is_missing_in_step()
        {
            StepLeaf leaf = toLeaf("a:1");
            IEnumerable <TextInput> inputs = table.InputsToDisplay(leaf);

            inputs.Select(x => x.Cell.Key).ToArray().ShouldEqual(new[] { "a", "b", "c" });
        }
Пример #2
0
        public void get_inputs_for_display_with_some_of_the_optional_atts_used()
        {
            StepLeaf leaf = toLeaf("a:1,b:2,c:3,d:4");
            IEnumerable <TextInput> inputs = table.InputsToDisplay(leaf);

            inputs.Select(x => x.Cell.Key).ToArray().ShouldEqual(new[] { "a", "b", "c", "d" });
        }
Пример #3
0
        public void ExecuteWithFixture <T>(StepLeaf leaf, ITestPart exceptionTarget) where T : IFixture
        {
            LoadFixture <T>(exceptionTarget);

            leaf.AcceptVisitor(this);

            RevertFixture(exceptionTarget);
        }
Пример #4
0
        private StepLeaf toLeaf(string props)
        {
            var  leaf  = new StepLeaf();
            Step child = new Step().With(props);

            leaf.Add(child);

            return(leaf);
        }
Пример #5
0
        public void clone_last_node_if_a_node_exists()
        {
            var leaf = new StepLeaf();
            leaf.Add(new Step("a"));

            leaf.CloneLastStep().ShouldNotBeTheSameAs(leaf.AllSteps()[0]);

            leaf.AllSteps().Count.ShouldEqual(1);
        }
Пример #6
0
        private void addChildSteps(IStep parent, INode sectionNode)
        {
            StepLeaf childSteps = parent.LeafFor(sectionNode.Name);

            sectionNode.ForEachChild(childStepNode =>
            {
                ITestPart child = ReadPart(childStepNode);
                childSteps.Add(child);
            });
        }
Пример #7
0
        public void clone_last_node_if_a_node_exists()
        {
            var leaf = new StepLeaf();

            leaf.Add(new Step("a"));

            leaf.CloneLastStep().ShouldNotBeTheSameAs(leaf.AllSteps()[0]);

            leaf.AllSteps().Count.ShouldEqual(1);
        }
Пример #8
0
        public void should_pick_up_children_of_child()
        {
            IStep thirdChild = theLeaf.AllSteps().ToList()[2];

            StepLeaf childLeaf = thirdChild.LeafFor("grandchild");

            childLeaf.AllSteps().Count.ShouldEqual(2);
            childLeaf.AllSteps()[0].Get("d").ShouldEqual("4");
            childLeaf.AllSteps()[0].Get("e").ShouldEqual("5");
        }
Пример #9
0
        public void add_step()
        {
            var leaf = new StepLeaf
            {
                DefaultChildStepName = "DaRow"
            };

            IStep step = leaf.AddNewStep();
            step.GrammarKey.ShouldEqual(leaf.DefaultChildStepName);
            leaf.AllSteps().Contains(step).ShouldBeTrue();
        }
Пример #10
0
        protected internal override void fillExample(IStep step)
        {
            StepLeaf leaf = leafFor(step);

            for (int i = 0; i < 3; i++)
            {
                IStep example = BuildExampleStep();

                leaf.Add(example);
            }
        }
Пример #11
0
        public void get_all_unique_attributes()
        {
            var leaf = new StepLeaf();
            leaf.Add(new Step().With("a:1,b:2,c:3"));
            leaf.Add(new Step().With("a:1,b:2"));
            leaf.Add(new Step().With("b:2,c:3,d:4"));
            leaf.Add(new Step().With("e:1"));
            leaf.Add(new Step().With("a:1,b:2,c:3"));

            leaf.GetAllUniqueAttributes().OrderBy(x => x).ShouldHaveTheSameElementsAs("a", "b", "c", "d", "e");
        }
Пример #12
0
 public void StartEmbeddedSection(EmbeddedSection section, IStep step)
 {
     withNewNode(step, Icon.EmbeddedSection, node =>
     {
         node.AddText(section.Label);
         addRearrangeCommands(node);
         StepLeaf leaf = section.LeafFor(step);
         node.Holder   = leaf;
         _configurer.ConfigurePartAdders(node, section.Fixture, leaf);
     });
 }
Пример #13
0
        public TableWriter GetWriter(IStep step)
        {
            StepLeaf leaf = leafFor(step);
            IEnumerable <TextInput> inputs = InputsToDisplay(leaf);

            return(new TableWriter
            {
                Leaf = leaf,
                Inputs = inputs,
                DisplayCells = inputs.Select(x => x.Cell)
            });
        }
Пример #14
0
        public void add_step()
        {
            var leaf = new StepLeaf
            {
                DefaultChildStepName = "DaRow"
            };

            IStep step = leaf.AddNewStep();

            step.GrammarKey.ShouldEqual(leaf.DefaultChildStepName);
            leaf.AllSteps().Contains(step).ShouldBeTrue();
        }
Пример #15
0
        public void get_all_unique_attributes()
        {
            var leaf = new StepLeaf();

            leaf.Add(new Step().With("a:1,b:2,c:3"));
            leaf.Add(new Step().With("a:1,b:2"));
            leaf.Add(new Step().With("b:2,c:3,d:4"));
            leaf.Add(new Step().With("e:1"));
            leaf.Add(new Step().With("a:1,b:2,c:3"));

            leaf.GetAllUniqueAttributes().ShouldHaveTheSameElementsAs("a", "b", "c", "d", "e");
        }
Пример #16
0
        public void clear_attribute()
        {
            var leaf = new StepLeaf();
            leaf.Add(new Step().With("a:1,b:2,c:3"));
            leaf.Add(new Step().With("a:1,b:2"));
            leaf.Add(new Step().With("b:2,c:3,d:4"));
            leaf.Add(new Step().With("e:1"));
            leaf.Add(new Step().With("a:1,b:2,c:3"));

            leaf.ClearAttribute("a");

            leaf.GetAllUniqueAttributes().ShouldHaveTheSameElementsAs("b", "c", "d", "e");
        }
Пример #17
0
        public void move_to_bottom_when_already_last()
        {
            var   leaf  = new StepLeaf();
            IStep step0 = leaf.AddNewStep();
            IStep step1 = leaf.AddNewStep();
            IStep step2 = leaf.AddNewStep();
            IStep step3 = leaf.AddNewStep();

            leaf.MoveToBottom(step3);

            leaf.AllSteps()[0].ShouldBeTheSameAs(step0);
            leaf.AllSteps()[1].ShouldBeTheSameAs(step1);
            leaf.AllSteps()[2].ShouldBeTheSameAs(step2);
            leaf.AllSteps()[3].ShouldBeTheSameAs(step3);
        }
Пример #18
0
        public void move_to_top_when_the_step_is_already_first()
        {
            var   leaf  = new StepLeaf();
            IStep step0 = leaf.AddNewStep();
            IStep step1 = leaf.AddNewStep();
            IStep step2 = leaf.AddNewStep();
            IStep step3 = leaf.AddNewStep();

            leaf.MoveToTop(step0);

            leaf.AllSteps()[0].ShouldBeTheSameAs(step0);
            leaf.AllSteps()[1].ShouldBeTheSameAs(step1);
            leaf.AllSteps()[2].ShouldBeTheSameAs(step2);
            leaf.AllSteps()[3].ShouldBeTheSameAs(step3);
        }
Пример #19
0
        public void set_step_value_should_set_a_value_on_all_steps()
        {
            var   leaf  = new StepLeaf();
            IStep step0 = leaf.AddNewStep();
            IStep step1 = leaf.AddNewStep();
            IStep step2 = leaf.AddNewStep();
            IStep step3 = leaf.AddNewStep();

            leaf.SetStepValue("a", "1");

            step0.Get("a").ShouldEqual("1");
            step1.Get("a").ShouldEqual("1");
            step2.Get("a").ShouldEqual("1");
            step3.Get("a").ShouldEqual("1");
        }
Пример #20
0
        private void GridWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var fixture = new TableFixture();
            var table = (ITable) fixture["Add"].ToStructure(null);

            var leaf = new StepLeaf();
            leaf.AddParts(
                new Step().With("w:1,x:2,y:3"),
                new Step().With("w:2,x:3,y:4"),
                new Step().With("w:5,x:6,y:7"),
                new Step().With("w:6,x:7,y:8"),
                new Step().With("w:7,x:8,y:9")
                );

            var controller = new TableController(grid);
            controller.Start(table, leaf);
        }
Пример #21
0
        public void SetUp()
        {
            step = new Step();
            StepLeaf leaf = step.LeafFor("record");

            leaf.Add(new Step().With("a:1,b:2"));
            leaf.Add(new Step().With("a:3,b:4"));
            leaf.Add(new Step().With("a:5,b:6"));

            inner   = new RecordingGrammar();
            grammar = new TableGrammar(inner.As <IGrammarWithCells>(), "record")
                      .Before(() => inner.Numbers.Add("0"))
                      .After(() => inner.Numbers.Add("7"));

            grammar.LabelName = "some label";

            grammar.Execute(step);
        }
Пример #22
0
        public void SetUp()
        {
            leaf = new StepLeaf();
            leaf.AddNewStep();
            leaf.AddNewStep();
            leaf.AddNewStep();
            leaf.AddNewStep();

            Cell b = Cell.For <int>("b");

            b.DefaultValue = "2";
            Cell a = Cell.For <int>("a");

            a.DefaultValue = "3";

            table = new Table("some label", "row", a, b);

            table.SetDefaultValueFor("b", leaf);
        }
Пример #23
0
        public void move_down_1()
        {
            var leaf = new StepLeaf();
            IStep step0 = leaf.AddNewStep();
            IStep step1 = leaf.AddNewStep();
            IStep step2 = leaf.AddNewStep();
            IStep step3 = leaf.AddNewStep();

            leaf.MoveDown(step0);

            leaf.AllSteps()[0].ShouldBeTheSameAs(step1);
            leaf.AllSteps()[1].ShouldBeTheSameAs(step0);
            leaf.AllSteps()[2].ShouldBeTheSameAs(step2);
            leaf.AllSteps()[3].ShouldBeTheSameAs(step3);

            leaf.MoveDown(step0);

            leaf.AllSteps()[0].ShouldBeTheSameAs(step1);
            leaf.AllSteps()[1].ShouldBeTheSameAs(step2);
            leaf.AllSteps()[2].ShouldBeTheSameAs(step0);
            leaf.AllSteps()[3].ShouldBeTheSameAs(step3);
        }
Пример #24
0
        public void move_down_1()
        {
            var   leaf  = new StepLeaf();
            IStep step0 = leaf.AddNewStep();
            IStep step1 = leaf.AddNewStep();
            IStep step2 = leaf.AddNewStep();
            IStep step3 = leaf.AddNewStep();

            leaf.MoveDown(step0);

            leaf.AllSteps()[0].ShouldBeTheSameAs(step1);
            leaf.AllSteps()[1].ShouldBeTheSameAs(step0);
            leaf.AllSteps()[2].ShouldBeTheSameAs(step2);
            leaf.AllSteps()[3].ShouldBeTheSameAs(step3);

            leaf.MoveDown(step0);

            leaf.AllSteps()[0].ShouldBeTheSameAs(step1);
            leaf.AllSteps()[1].ShouldBeTheSameAs(step2);
            leaf.AllSteps()[2].ShouldBeTheSameAs(step0);
            leaf.AllSteps()[3].ShouldBeTheSameAs(step3);
        }
Пример #25
0
        public void write_a_second_test()
        {
            var  section = new Section("AutoDispatchConfiguration");
            Test test    = new Test("AutoDispatchRules").With(section);

            Step     step1 = section.AddStep("IfPriorityEquals").With("priority", "High");
            StepLeaf leaf1 = step1.LeafFor("AndOr");

            leaf1.Add(new Step("AndStatusEquals").With("status", "Open"));
            leaf1.Add(new Step("AndTitleEquals").With("title", "This one"));

            StepLeaf leaf2 = step1.LeafFor("AutoDispatchAction");

            leaf2.Add(new Step("AssignToUser").With("user", "annieAgent"));

            var node = new JsonNode("Test");

            var visitor = new WriterVisitor(test, node);

            visitor.Write();

            Debug.WriteLine(node.ToJson());
        }
Пример #26
0
        public void get_hidden_display_2()
        {
            StepLeaf leaf = toLeaf("a:1,b:2,c:3,d:4");

            table.HiddenInputs(leaf).ShouldEqual(new[] { "e" });
        }
Пример #27
0
        public void SetDefaultValueFor(string key, StepLeaf leaf)
        {
            Cell cell = _cells.First(x => x.Key == key);

            leaf.SetStepValue(key, cell.DefaultValue);
        }
Пример #28
0
        public void move_up_when_the_step_is_already_first()
        {
            var leaf = new StepLeaf();
            IStep step0 = leaf.AddNewStep();
            IStep step1 = leaf.AddNewStep();
            IStep step2 = leaf.AddNewStep();
            IStep step3 = leaf.AddNewStep();

            leaf.MoveUp(step0);

            leaf.AllSteps()[0].ShouldBeTheSameAs(step0);
            leaf.AllSteps()[1].ShouldBeTheSameAs(step1);
            leaf.AllSteps()[2].ShouldBeTheSameAs(step2);
            leaf.AllSteps()[3].ShouldBeTheSameAs(step3);
        }
Пример #29
0
        private StepLeaf toLeaf(string props)
        {
            var leaf = new StepLeaf();
            Step child = new Step().With(props);
            leaf.Add(child);

            return leaf;
        }
Пример #30
0
 public IEnumerable<TextInput> InputsToDisplay(StepLeaf leaf)
 {
     IEnumerable<string> attributes = leaf.GetAllUniqueAttributes();
     return _inputs.Where(x => attributes.Contains(x.Cell.Key) || !x.Cell.HasDefault());
 }
Пример #31
0
 public void SetDefaultValueFor(string key, StepLeaf leaf)
 {
     Cell cell = _cells.First(x => x.Key == key);
     leaf.SetStepValue(key, cell.DefaultValue);
 }
Пример #32
0
 public void ExecuteWithFixture <T>(StepLeaf leaf, ITestPart exceptionTarget) where T : IFixture
 {
 }
Пример #33
0
        public void set_step_value_should_set_a_value_on_all_steps()
        {
            var leaf = new StepLeaf();
            IStep step0 = leaf.AddNewStep();
            IStep step1 = leaf.AddNewStep();
            IStep step2 = leaf.AddNewStep();
            IStep step3 = leaf.AddNewStep();

            leaf.SetStepValue("a", "1");

            step0.Get("a").ShouldEqual("1");
            step1.Get("a").ShouldEqual("1");
            step2.Get("a").ShouldEqual("1");
            step3.Get("a").ShouldEqual("1");
        }
Пример #34
0
        public IEnumerable <TextInput> InputsToDisplay(StepLeaf leaf)
        {
            IEnumerable <string> attributes = leaf.GetAllUniqueAttributes();

            return(_inputs.Where(x => attributes.Contains(x.Cell.Key) || !x.Cell.HasDefault()));
        }
Пример #35
0
 public void clone_last_node_does_nothing_and_returns_false_if_no_other_steps_exist()
 {
     var leaf = new StepLeaf();
     leaf.CloneLastStep().ShouldBeNull();
 }
Пример #36
0
        public void clone_last_node_does_nothing_and_returns_false_if_no_other_steps_exist()
        {
            var leaf = new StepLeaf();

            leaf.CloneLastStep().ShouldBeNull();
        }
Пример #37
0
        public string[] HiddenInputs(StepLeaf leaf)
        {
            IEnumerable <string> attributes = leaf.GetAllUniqueAttributes();

            return(_cells.Where(x => !attributes.Contains(x.Key)).Select(x => x.Key).ToArray());
        }
Пример #38
0
 public string[] HiddenInputs(StepLeaf leaf)
 {
     IEnumerable<string> attributes = leaf.GetAllUniqueAttributes();
     return _cells.Where(x => !attributes.Contains(x.Key)).Select(x => x.Key).ToArray();
 }
Пример #39
0
        public void SetUp()
        {
            leaf = new StepLeaf();
            leaf.AddNewStep();
            leaf.AddNewStep();
            leaf.AddNewStep();
            leaf.AddNewStep();

            Cell b = Cell.For<int>("b");
            b.DefaultValue = "2";
            Cell a = Cell.For<int>("a");
            a.DefaultValue = "3";

            table = new Table("some label", "row", a, b);

            table.SetDefaultValueFor("b", leaf);
        }
Пример #40
0
        public void move_to_bottom_when_already_last()
        {
            var leaf = new StepLeaf();
            IStep step0 = leaf.AddNewStep();
            IStep step1 = leaf.AddNewStep();
            IStep step2 = leaf.AddNewStep();
            IStep step3 = leaf.AddNewStep();

            leaf.MoveToBottom(step3);

            leaf.AllSteps()[0].ShouldBeTheSameAs(step0);
            leaf.AllSteps()[1].ShouldBeTheSameAs(step1);
            leaf.AllSteps()[2].ShouldBeTheSameAs(step2);
            leaf.AllSteps()[3].ShouldBeTheSameAs(step3);
        }