Inheritance: ITestWriter
        public void SetUp()
        {
            var test = new Test("a test name");
            test.AddComment("more text");
            test.Section("Address").WithDescription("the address section")
                .WithStep("grammar1", "a:1,b:2,c:3")
                .WithStep("grammar2", "d:4,e:5")
                .WithStep("grammar3", "f:6")
                .WithComment("a bunch of text");

            var section = test.Section("Contact")
                .WithStep("grammar4", "g:7,h:8")
                .WithStep("grammar5", step =>
                {
                    step.With("i:9,j:10");
                    step.WithChildren("child1", new Step("g6").With("t:1,v:2"), new Step("g7"));
                    step.WithChildren("child2", new Step("g8"), new Step("g9"));
                });

            XmlDocument document = new TestWriter().Write(test);

            element = document.DocumentElement;

            Debug.WriteLine(element.OuterXml);
        }
        public void should_write_out_the_lifecycle()
        {
            var test = new Test("name");
            XmlDocument document = new TestWriter().Write(test);

            document.DocumentElement.GetAttribute("lifecycle").ShouldEqual(test.Lifecycle.ToString());
        }
        public JavaScriptTestFile AddTest(string name, Test test)
        {
            string json = new TestWriter().WriteToJson(test);

            string script = "var {0} = new Step({1});".ToFormat(name, json);
            AddJavaScript(script);

            return this;
        }
        public void apply_json_changes_integrated_tester()
        {
            // I'm starting with a test with 2 comments, adding one comment
            // from the json, then converting back to the test.  The test should
            // only have the new comment afterwards
            var test = new Test("test1", x =>
            {
                x.Add(new Comment("some text"));
                x.Add(new Comment("some other text"));
            });

            var test2 = test.Clone("something");
            test2.Add(new Comment("another"));

            var json = new TestWriter().WriteToJson(test2);

            theConverter.ApplyJsonChanges(test, json);
            test.Parts.Count.ShouldEqual(3);
            test.Parts.Last().ShouldBeOfType<Comment>().Text.ShouldEqual("another");
        }
        private Counts running(string name)
        {
            Test test = hierarchy.FindFirstTestWithName(name);

            string json = new TestWriter().WriteToJson(test);
            Test test2 = new TestReader().ReadFromJson(json);

            test2.ShouldNotBeNull();
            test2.LastResult = runner.RunTest(test2);

            //runner.WriteResults(test).OpenInBrowser();

            return test2.LastResult.Counts;
        }
 public void the_initial_xml()
 {
     string xml = new TestWriter().Write(test).OuterXml;
     manager.CurrentXml.ShouldEqual(xml);
 }
 public void the_initial_json()
 {
     string json = new TestWriter().WriteToJson(test);
     manager.CurrentJson.ShouldEqual(json);
 }