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); }
/// <summary> /// Compares a test framework deserialised from the provided embedded resource against the expected one /// using the specified encoding to read the resource file /// </summary> /// <param name="resource">Path to an embedded resource which is to be treated as input for TestFramework deserialisation</param> /// <param name="expected">The TestFramework which the deserialised version should be compared against</param> /// <param name="encoding">The encoding by which to interpret the resource file</param> private void Compare(string resource, TestFramework expected, Encoding encoding) { Stream stream = null; try { stream = TestHelper.LoadEmbeddedResource(resource); using (var reader = new StreamReader(stream, encoding)) { stream = null; TestFrameworkDOTDeserialiser parser = new TestFrameworkDOTDeserialiser(Source); TestFramework framework = parser.Deserialise(reader); FrameworkEqualityVisitor.IsEqualTo(framework, expected, false); } } finally { if (stream != null) { stream.Dispose(); } } }
/// <summary> /// Compares a test framework deserialised from the provided embedded resource against the expected one /// </summary> /// <param name="resource">Path to an embedded resource which is to be treated as input for TestFramework deserialisation</param> /// <param name="expected">The TestFramework which the deserialised version should be compared against</param> private void Compare(string resource, TestFramework expected) { using (var stream = TestHelper.LoadEmbeddedResource(resource)) { TestFrameworkDOTDeserialiser parser = new TestFrameworkDOTDeserialiser(Source); TestFramework framework = parser.Deserialise(stream); FrameworkEqualityVisitor.IsEqualTo(framework, expected); } }
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); }