상속: ITestReader, ITestFileReader
예제 #1
0
        public void read_a_comment_from_directly_under_the_test_node()
        {
            string commentText = "some text in the comment";

            XmlDocument doc = new XmlDocument().Configure(x =>
            {
                x.WithRoot("Test").WithAtt("name", "something")
                    .AddElement("Comment").InnerText = commentText;
            });

            var reader = new TestReader();
            Test test = reader.ReadTest(doc.DocumentElement);

            var comment = test.Parts[0].ShouldBeOfType<Comment>();
            comment.Text.ShouldEqual(commentText);
        }
        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;
        }
예제 #3
0
        public void the_test_should_now_be_saved_at_the_new_file_location()
        {
            File.Exists("New Name.xml");

            Test test2 = new TestReader().ReadFromFile("New Name.xml");
            test2.Parts[0].ShouldBeOfType<Comment>().Text.ShouldEqual("some comment");
        }
예제 #4
0
        public void save_and_load_a_test()
        {
            var project = new Project
            {
                BinaryFolder = string.Empty,
                ProjectFolder = "",
                TestFolder = ""
            };
            var test = new Test("test to be saved");
            test.AddComment("some comment");
            test.FileName = "Test001.xml";

            project.Save(test);

            Test test2 = new TestReader().ReadFromFile(test.FileName);
            test2.Name.ShouldEqual(test.Name);
            test2.Parts.Count.ShouldEqual(1);

            test2.FileName.ShouldEqual("Test001.xml");
        }