public void apply_renumbering()
        {
            var spec = new Specification();
            var c1   = new Comment();

            spec.Children.Add(c1);
            var section1 = new Section("Foo");
            var s1       = section1.AddStep("foo1");
            var s2       = section1.AddStep("foo1");
            var s3       = section1.AddStep("foo1");


            var section2 = s3.AddCollection("rows");
            var s4       = section2.AddStep("r1");
            var s5       = section2.AddStep("r1");
            var s6       = section2.AddStep("r1");

            s4.id = s5.id = s6.id = Guid.NewGuid().ToString();

            spec.Children.Add(section1);
            var c2 = new Comment();

            spec.Children.Add(c2);

            spec.ApplyRenumbering();

            s4.id.ShouldNotBe(s5.id);
            s5.id.ShouldNotBe(s6.id);
            s4.id.ShouldNotBe(s6.id);
        }
        public void serializes_fine()
        {
            var spec = new Specification();
            var c1   = new Comment();

            spec.Children.Add(c1);
            var section1 = new Section("Foo");
            var s1       = section1.AddStep("foo1");
            var s2       = section1.AddStep("foo1");
            var s3       = section1.AddStep("foo1");


            var section2 = s3.AddCollection("rows");
            var s4       = section2.AddStep("r1");
            var s5       = section2.AddStep("r1");
            var s6       = section2.AddStep("r1");

            spec.Children.Add(section1);
            var c2 = new Comment();

            spec.Children.Add(c2);

            var json = JsonSerialization.ToJson(spec, true);

            Debug.WriteLine(json);
        }
Example #3
0
        public void can_handle_multi_line_comment_within_a_section()
        {
            original.name = "Some spec";

            var comment = new Comment
            {
                Text = @"hello,
how are you today?

** Well, thank you"
            };

            var section = new Section("MyThing");

            section.AddStep("Go");
            section.Children.Add(comment);
            section.AddStep("Stop");

            original.Children.Add(section);

            compare(original, persisted);

            original.Children.Add(new Comment {
                Text = "Hey\nyou!"
            });
        }
        public void needs_renumbering_is_true_because_there_are_duplicate_ids()
        {
            var spec = new Specification();
            var c1   = new Comment();

            spec.Children.Add(c1);
            var section1 = new Section("Foo");
            var s1       = section1.AddStep("foo1");
            var s2       = section1.AddStep("foo1");
            var s3       = section1.AddStep("foo1");


            var section2 = s3.AddCollection("rows");
            var s4       = section2.AddStep("r1");
            var s5       = section2.AddStep("r1");
            var s6       = section2.AddStep("r1");

            s4.id = s5.id = s6.id = Guid.NewGuid().ToString();

            spec.Children.Add(section1);
            var c2 = new Comment();

            spec.Children.Add(c2);

            spec.NeedsToBeRenumbered().ShouldBeTrue();
        }
Example #5
0
        public void creates_example_test()
        {
            var     template = new Test("some test");
            Section section  = template.Section("Math");

            section.AddStep("step1");
            section.AddStep("step2");
            section.AddStep("step3");

            new FixtureGraph("Math").ModifyExampleTest(template);
            template.Parts.Count.ShouldEqual(1);
            template.Parts[0].ShouldBeOfType <Section>();
        }
        public void section_with_a_single_step_that_only_has_values()
        {
            var section = new Section("Math");

            section.AddStep("Add").With("x", "1").With("y", "2").With("sum", "3");

            Debug.WriteLine(section.ToJson());
        }
        public void can_find_all_children()
        {
            var spec = new Specification();
            var c1   = new Comment();

            spec.Children.Add(c1);
            var section1 = new Section("Foo");
            var s1       = section1.AddStep("foo1");
            var s2       = section1.AddStep("foo1");
            var s3       = section1.AddStep("foo1");


            var section2 = s3.AddCollection("rows");
            var s4       = section2.AddStep("r1");
            var s5       = section2.AddStep("r1");
            var s6       = section2.AddStep("r1");

            spec.Children.Add(section1);
            var c2 = new Comment();

            spec.Children.Add(c2);

            var nodes = spec.AllNodes();

            // All comments, steps, sections, and the spec itself
            nodes.Count().ShouldBe(11);

            nodes.ShouldContain(spec);
            nodes.ShouldContain(section1);
            nodes.ShouldContain(section2);
            nodes.ShouldContain(c1);
            nodes.ShouldContain(c2);
            nodes.ShouldContain(s1);
            nodes.ShouldContain(s2);
            nodes.ShouldContain(s3);
            nodes.ShouldContain(s4);
            nodes.ShouldContain(s5);
            nodes.ShouldContain(s6);
        }
        public void read_and_write_with_cell_values_that_have_delimited_arrays()
        {
            var section = new Section("Math");

            section.AddStep("Foo").With("Values", "A, B, C");

            original.Children.Add(section);


            section = persisted.Children[0].As <Section>();
            section.Children[0].As <Step>().Values["Values"]
            .ShouldBe("A, B, C");
        }
        public void needs_renumbering_negative()
        {
            var spec = new Specification();
            var c1   = new Comment();

            spec.Children.Add(c1);
            var section1 = new Section("Foo");
            var s1       = section1.AddStep("foo1");
            var s2       = section1.AddStep("foo1");
            var s3       = section1.AddStep("foo1");


            var section2 = s3.AddCollection("rows");
            var s4       = section2.AddStep("r1");
            var s5       = section2.AddStep("r1");
            var s6       = section2.AddStep("r1");

            spec.Children.Add(section1);
            var c2 = new Comment();

            spec.Children.Add(c2);

            spec.NeedsToBeRenumbered().ShouldBeFalse();
        }
        public void has_not_steps()
        {
            var spec = new Specification();

            spec.HasNoSteps().ShouldBeTrue();

            var section = new Section("something");

            spec.Children.Add(section);
            spec.HasNoSteps().ShouldBeTrue();

            section.AddStep("somethingelse");

            spec.HasNoSteps().ShouldBeFalse();
        }
        public void can_escape_pipe_bar_in_table_data()
        {
            original.name = "Some spec";
            var section = new Section("Math");

            var tableStep = section.AddStep("table");
            var rows      = tableStep.AddCollection("rows");

            rows.AddStep("row").With("a", "1");
            rows.AddStep("row").With("a", "2");
            rows.AddStep("row").With("a", "1|2|3");

            original.Children.Add(section);

            compare(original, persisted);
        }
Example #12
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());
        }
Example #13
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());
        }