Ejemplo n.º 1
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");
        }
Ejemplo n.º 2
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");
        }
Ejemplo n.º 3
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");
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 6
0
        private StepLeaf toLeaf(string props)
        {
            var  leaf  = new StepLeaf();
            Step child = new Step().With(props);

            leaf.Add(child);

            return(leaf);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 8
0
        private void addChildSteps(IStep parent, INode sectionNode)
        {
            StepLeaf childSteps = parent.LeafFor(sectionNode.Name);

            sectionNode.ForEachChild(childStepNode =>
            {
                ITestPart child = ReadPart(childStepNode);
                childSteps.Add(child);
            });
        }
Ejemplo n.º 9
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);
            }
        }
Ejemplo n.º 10
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());
        }
Ejemplo n.º 11
0
        private StepLeaf toLeaf(string props)
        {
            var leaf = new StepLeaf();
            Step child = new Step().With(props);
            leaf.Add(child);

            return leaf;
        }