예제 #1
0
        public void contains_works_n_deep()
        {
            Hierarchy hierarchy =
                DataMother.BuildHierarchy(
                    @"
t1,Success
t2,Failure
t3,Success
s1/t4,Success
s1/t5,Success
s1/t6,Failure
s1/s2/t7,Success
s1/s2/t8,Failure
s1/s2/s3/t9,Success
s1/s2/s3/t10,Success
s1/s2/s3/s4/t11,Success
s5/t12,Success
s5/s6/t13,Success
s5/s6/s7/t14,Success
s5/s6/s7/s8/t15,Success
");

            Test test = hierarchy.FindTest("s1/s2/s3/s4/t11");

            hierarchy.Contains(test).ShouldBeTrue();
            hierarchy.FindSuite("s1").Contains(test).ShouldBeTrue();
            hierarchy.FindSuite("s1/s2").Contains(test).ShouldBeTrue();
            hierarchy.FindSuite("s1/s2/s3").Contains(test).ShouldBeTrue();
            hierarchy.FindSuite("s1/s2/s3/s4").Contains(test).ShouldBeTrue();

            hierarchy.FindSuite("s5").Contains(test).ShouldBeFalse();
            hierarchy.FindSuite("s5/s6").Contains(test).ShouldBeFalse();
            hierarchy.FindSuite("s5/s6/s7").Contains(test).ShouldBeFalse();
        }
예제 #2
0
        public void get_all_tests_n_deep()
        {
            Hierarchy hierarchy =
                DataMother.BuildHierarchy(
                    @"
t1,Success
t2,Failure
t3,Success
s1/t4,Success
s1/t5,Success
s1/t6,Failure
s1/s2/t7,Success
s1/s2/t8,Failure
s1/s2/s3/t9,Success
s1/s2/s3/t10,Success
s1/s2/s3/s4/t11,Success
s5/t12,Success
s5/s6/t13,Success
s5/s6/s7/t14,Success
s5/s6/s7/s8/t15,Success
s9/t16,Success
s9/t17,Success
s9/t18,Success
");

            hierarchy.GetAllTests().Count().ShouldEqual(18);
            hierarchy.FindSuite("s1").GetAllTests().Count().ShouldEqual(8);
            hierarchy.FindSuite("s5/s6").GetAllTests().Count().ShouldEqual(3);
        }
예제 #3
0
        public void find_all_workspaces_from_a_project()
        {
            hierarchy =
                DataMother.BuildHierarchy(
                    @"
s1/t4,Success
s1/t5,Success
s1/t6,Failure
s1/s2/t7,Success
s1/s2/t8,Failure
s1/s2/s3/t9,Success
s1/s2/s3/t10,Success
s1/s2/s3/s4/t11,Success
s5/t12,Failure
s5/s6/t13,Success
s5/s6/s7/t14,Success
s5/s6/s7/s8/t15,Success
s9/t16,Success
s9/t17,Success
s9/t18,Failure
");

            var project = new Project();

            hierarchy.FindAllWorkspaces(project).Select(x => x.Name).ShouldHaveTheSameElementsAs("s1", "s5", "s9");
        }
예제 #4
0
        public void write_some_html()
        {
            Project     project = DataMother.MathProject();
            ITestRunner runner  = project.LocalRunner();

            Test test = project.LoadTests().GetAllTests().First();

            runner.RunTest(test);

            test.OpenResultsInBrowser();
        }
예제 #5
0
        public void get_full_results_history_smoke_test()
        {
            var h = DataMother.MathProject().LoadTests();

            h.GetAllTests().Each(x => x.LastResult = new TestResult());

            var results = h.GetFullResults();

            h.GetAllTests().Each(x =>
            {
                results[x].ShouldBeTheSameAs(x.LastResult);
            });
        }
예제 #6
0
        public void write_and_open_a_test_editor()
        {
            var project = DataMother.GrammarProject();
            var test    = project.LoadTests().FindTest("Sentences");

            var builder  = new TestEditorBuilder();
            var document = builder.BuildTestEditor(test, project.LocalRunner().Library);

            document.WriteToFile("editor.htm");

            var path = Path.GetFullPath("editor.htm");

            Process.Start("iexplore.exe", path);
        }
예제 #7
0
        public void verify_child_parent_relationships_smoke_test()
        {
            var h = DataMother.MathProject().LoadTests();

            h.GetAllTests().Each(x =>
            {
                Assert.IsNotNull(x.Parent);
                Assert.IsTrue(x.SuiteName.Contains(x.Parent.Name));
                if (x.Parent.Parent != null)
                {
                    Assert.IsTrue(x.SuiteName.Contains("/"));
                    Assert.IsTrue(x.SuiteName.Contains(x.Parent.Parent.Name));
                }
            });
        }