public void ParseEmptyTestList()
        {
            TestFramework expected = new TestFrameworkBuilder("", "Master Test Suite", 1).Build();
            TestFramework framework = Deserialize("BoostTestAdapterNunit.Resources.TestLists.empty.test.list.xml");

            FrameworkEqualityVisitor.IsEqualTo(framework, expected);
        }
        public void TestQualifiedNamingScheme()
        {
            TestFramework framework = new TestFrameworkBuilder(Source, "Master Test Suite", 1).
                TestCase("test", 2).
                TestSuite("suite", 3).
                    TestSuite("suite", 4).
                        TestCase("test", 5).
                    EndSuite().
                EndSuite().
                Build();

            // Master Test Suite fully qualified name is equivalent to the empty string
            Assert.That(framework.MasterTestSuite.FullyQualifiedName, Is.Empty);

            // Test Units which fall directly under the Master Test Suite will
            // have their (local) name equivalent to their fully qualified name
            foreach (TestUnit child in framework.MasterTestSuite.Children)
            {
                Assert.That(child.FullyQualifiedName, Is.EqualTo(child.Name));
            }

            // Test Fully Qualified Name scheme via lookup

            TestUnit test = Lookup(framework.MasterTestSuite, "test");
            AssertTestCase(test, 2, null, framework.MasterTestSuite);

            TestUnit suite = Lookup(framework.MasterTestSuite, "suite");
            AssertTestSuite(suite, 3, framework.MasterTestSuite);

            TestUnit suiteSuite = Lookup(framework.MasterTestSuite, "suite/suite");
            AssertTestSuite(suiteSuite, 4, suite);

            TestUnit suiteSuiteTest = Lookup(framework.MasterTestSuite, "suite/suite/test");
            AssertTestCase(suiteSuiteTest, 5, null, suiteSuite);
        }
        public void SerializeTestFramework()
        {
            string sourceFile = "test_runner_test.cpp";

            TestFramework framework = new TestFrameworkBuilder(Source, "Test runner test", 1).
                TestCase("test1", 65536, new SourceFileInfo(sourceFile, 26)).
                TestCase("test2", 65537, new SourceFileInfo(sourceFile, 35)).
                TestSuite("SampleSuite", 2).
                    TestSuite("SampleNestedSuite", 3).
                        TestCase("test3", 65538, new SourceFileInfo(sourceFile, 48)).
                    EndSuite().
                EndSuite().
                TestSuite("TemplateSuite", 4).
                    TestCase("my_test<char>", 65539, new SourceFileInfo(sourceFile, 79)).
                    TestCase("my_test<int>", 65540, new SourceFileInfo(sourceFile, 79)).
                    TestCase("my_test<float>", 65541, new SourceFileInfo(sourceFile, 79)).
                    TestCase("my_test<double>", 65542, new SourceFileInfo(sourceFile, 79)).
                EndSuite().
                Build();

            using (Stream stream = TestHelper.LoadEmbeddedResource("BoostTestAdapterNunit.Resources.TestLists.sample.test.list.xml"))
            {
                XmlDocument baseXml = new XmlDocument();
                baseXml.Load(stream);

                XmlComparer comparer = new XmlComparer();
                comparer.CompareXML(baseXml, Serialize(framework), XmlNodeTypeFilter.DefaultFilter);
            }
        }
        public void ParseTestList()
        {
            const string sourceFile = "test_runner_test.cpp";

            TestFramework expected = new TestFrameworkBuilder(Source, "Test runner test", 1).
                TestCase("test1", 65536, new SourceFileInfo(sourceFile, 26)).
                TestCase("test2", 65537, new SourceFileInfo(sourceFile, 35)).
                TestSuite("SampleSuite", 2).
                    TestSuite("SampleNestedSuite", 3).
                        TestCase("test3", 65538, new SourceFileInfo(sourceFile, 48)).
                    EndSuite().
                EndSuite().
                TestSuite("TemplateSuite", 4).
                    TestCase("TemplateSuite/my_test<char>", 65539, new SourceFileInfo(sourceFile, 79)).
                    TestCase("TemplateSuite/my_test<int>", 65540, new SourceFileInfo(sourceFile, 79)).
                    TestCase("TemplateSuite/my_test<float>", 65541, new SourceFileInfo(sourceFile, 79)).
                    TestCase("TemplateSuite/my_test<double>", 65542, new SourceFileInfo(sourceFile, 79)).
                EndSuite().
            Build();

            TestFramework framework = Deserialize("BoostTestAdapterNunit.Resources.TestLists.sample.test.list.xml");

            FrameworkEqualityVisitor.IsEqualTo(framework, expected);
        }
        public void DeserialiseDOT()
        {
            TestFramework expected = new TestFrameworkBuilder(Source, "sample", 1, false).
                TestSuite("suite_1", 2, new SourceFileInfo(@"d:\sample.boostunittest\file_1.cpp", 6), false).
                    TestSuite("suite_2", 3, new SourceFileInfo(@"d:\sample.boostunittest\file_1.cpp", 8), false).
                        TestCase("test_3", 65536, new SourceFileInfo(@"d:\sample.boostunittest\file_1.cpp", 14), null, false).
                        TestCase("test_4", 65537, new SourceFileInfo(@"d:\sample.boostunittest\file_1.cpp", 44), null, false).
                        TestCase("test_5", 65538, new SourceFileInfo(@"d:\sample.boostunittest\file_1.cpp", 62), null, false).
                    EndSuite().
                    TestSuite("suite_6", 4, new SourceFileInfo(@"d:\sample.boostunittest\file_2.cpp", 19), false).
                        TestCase("test_7", 65539, new SourceFileInfo(@"d:\sample.boostunittest\file_2.cpp", 24), null, false).
                        TestCase("test_8", 65540, new SourceFileInfo(@"d:\sample.boostunittest\file_2.cpp", 40), null, false).
                        TestCase("test_9", 65541, new SourceFileInfo(@"d:\sample.boostunittest\file_2.cpp", 90), null, false).
                        TestCase("test_10", 65542, new SourceFileInfo(@"d:\sample.boostunittest\file_2.cpp", 105), null, false).
                        TestCase("test_11", 65543, new SourceFileInfo(@"d:\sample.boostunittest\file_2.cpp", 121), null, false).
                        TestCase("test_12", 65544, new SourceFileInfo(@"d:\sample.boostunittest\file_2.cpp", 134), null, false).
                        TestCase("test_13", 65545, new SourceFileInfo(@"d:\sample.boostunittest\file_2.cpp", 310), null, false).
                    EndSuite().
                    TestSuite("suite_14", 5, new SourceFileInfo(@"d:\sample.boostunittest\file_3.cpp", 20), false).
                        TestCase("test_15", 65546, new SourceFileInfo(@"d:\sample.boostunittest\file_3.cpp", 27), null, false).
                        TestCase("test_16", 65547, new SourceFileInfo(@"d:\sample.boostunittest\file_3.cpp", 49), null, false).
                        TestCase("test_17", 65548, new SourceFileInfo(@"d:\sample.boostunittest\file_3.cpp", 59), null, false).
                        TestCase("test_18", 65549, new SourceFileInfo(@"d:\sample.boostunittest\file_3.cpp", 88), null, false).
                    EndSuite().
                    TestSuite("suite_19", 6, new SourceFileInfo(@"d:\sample.boostunittest\file_4.cpp", 7), false).
                        TestCase("test_20", 65550, new SourceFileInfo(@"d:\sample.boostunittest\file_4.cpp", 12), null, false).
                    EndSuite().
                    TestSuite("suite_21", 7, new SourceFileInfo(@"d:\sample.boostunittest\file_5.cpp", 8), false).
                        TestCase("test_22", 65551, new SourceFileInfo(@"d:\sample.boostunittest\file_5.cpp", 14), null, false).
                    EndSuite().
                    TestSuite("suite_23", 8, new SourceFileInfo(@"d:\sample.boostunittest\file_6.cpp", 13), false).
                        TestCase("test_24", 65552, new SourceFileInfo(@"d:\sample.boostunittest\file_6.cpp", 18), null, false).
                        TestCase("test_25", 65553, new SourceFileInfo(@"d:\sample.boostunittest\file_6.cpp", 28), null, false).
                        TestCase("test_26", 65554, new SourceFileInfo(@"d:\sample.boostunittest\file_6.cpp", 38), null, false).
                        TestCase("test_27", 65555, new SourceFileInfo(@"d:\sample.boostunittest\file_6.cpp", 48), null, false).
                        TestCase("test_28", 65556, new SourceFileInfo(@"d:\sample.boostunittest\file_6.cpp", 59), null, false).
                        TestCase("test_29", 65557, new SourceFileInfo(@"d:\sample.boostunittest\file_6.cpp", 70), null, false).
                    EndSuite().
                    TestSuite("suite_30", 9, new SourceFileInfo(@"d:\sample.boostunittest\file_7.cpp", 8), false).
                        TestCase("test_31", 65558, new SourceFileInfo(@"d:\sample.boostunittest\file_7.cpp", 14), new[] { "hello", "world", "labels" }, false).
                    EndSuite().
                EndSuite().
            Build();

            Compare("BoostTestAdapterNunit.Resources.ListContentDOT.sample.list.content.gv", expected);
        }
        public void TestsWithDecorators()
        {
            TestFramework expected = new TestFrameworkBuilder(Source, "Sample", 1).
                TestSuite("Suite1", 2, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 11)).
                    TestCase("MyBoost_Test1", 65536, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 12)).
                    TestCase("MyBoost_Test2", 65537, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 16), null, false).
                    TestCase("MyBoost_Test3", 65538, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 20)).
                    TestCase("MyBoost_Test4", 65539, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 24), null, false).
                EndSuite().
                TestCase("MyBoost_Test5", 65540, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 30)).
                TestCase("MyBoost_Test6", 65541, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 34), null, false).
                TestCase("MyBoost_Test7", 65542, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 38)).
                TestCase("MyBoost_Test8", 65543, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 42), null, false).
            Build();

            Compare("BoostTestAdapterNunit.Resources.ListContentDOT.test_list_content.gv", expected);
        }
        public void TestSuiteWithChildTestsAndSuites()
        {
            TestFramework expected = new TestFrameworkBuilder(Source, "MyTest", 1, false).
                TestCase("Test", 65536, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 30),null, false).
                TestSuite("Suite", 2, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 35), false).
                    TestCase("Test", 65537, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 37),null, false).
                EndSuite().
                TestCase("TestB", 65538, new SourceFileInfo(@"c:\boostunittest\boostunittestsample.cpp", 44), null, false).
            Build();

            Compare("BoostTestAdapterNunit.Resources.ListContentDOT.sample.3.list.content.gv", expected);
        }