From: Oleg T. <he...@us...> - 2004-10-18 18:19:31
|
Update of /cvsroot/mvp-xml/XInclude/v1/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23707/v1/test Modified Files: EntryPoint.cs NistTests.cs XIncludeReaderTests.cs Log Message: Testing... Index: EntryPoint.cs =================================================================== RCS file: /cvsroot/mvp-xml/XInclude/v1/test/EntryPoint.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- EntryPoint.cs 17 Oct 2004 21:01:12 -0000 1.1 +++ EntryPoint.cs 18 Oct 2004 18:19:21 -0000 1.2 @@ -10,10 +10,11 @@ public static void Main() { //XIncludeReaderTests rt = new XIncludeReaderTests(); - EdUniTests rt = new EdUniTests(); + //EdUniTests rt = new EdUniTests(); + NistTests rt = new NistTests(); try { - rt.Test2(); + rt.Test24(); } catch (Exception e) { Index: XIncludeReaderTests.cs =================================================================== RCS file: /cvsroot/mvp-xml/XInclude/v1/test/XIncludeReaderTests.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- XIncludeReaderTests.cs 17 Oct 2004 21:01:12 -0000 1.3 +++ XIncludeReaderTests.cs 18 Oct 2004 18:19:22 -0000 1.4 @@ -32,7 +32,16 @@ XmlValidatingReader vr = new XmlValidatingReader(new XmlTextReader(source)); vr.ValidationType = ValidationType.None; vr.EntityHandling = EntityHandling.ExpandEntities; - doc.Load(new XIncludingReader(vr)); + try + { + doc.Load(new XIncludingReader(vr)); + } + catch (Exception e) + { + vr.Close(); + throw e; + } + vr.Close(); XmlTextReader r1 = new XmlTextReader(new StringReader(doc.OuterXml)); r1.WhitespaceHandling = WhitespaceHandling.Significant; XmlTextReader r2 = new XmlTextReader(result); @@ -124,8 +133,7 @@ r2 = null; StreamReader sr = new StreamReader(result); string expectedResult = sr.ReadToEnd(); - sr.Close(); - XIncludingReader xir = new XIncludingReader(source); + sr.Close(); MemoryStream ms = new MemoryStream(); doc.Save(new StreamWriter(ms, Encoding.UTF8)); ms.Position = 0; @@ -135,7 +143,7 @@ throw e; } finally - { + { if (r1 != null) r1.Close(); if (r2 != null) Index: NistTests.cs =================================================================== RCS file: /cvsroot/mvp-xml/XInclude/v1/test/NistTests.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- NistTests.cs 16 Oct 2004 21:03:15 -0000 1.1 +++ NistTests.cs 18 Oct 2004 18:19:22 -0000 1.2 @@ -245,6 +245,7 @@ /// Test should fail because is including more than one element. /// </summary> [Test] + [ExpectedException(typeof(MalformedXInclusionResultError))] public void Test23() { RunAndCompare("nist-include-23.xml", "nist-include-23.xml"); @@ -325,6 +326,7 @@ /// /// </summary> [Test] + [ExpectedException(typeof(FatalResourceException))] public void Test32() { RunAndCompare("nist-include-32.xml", "nist-include-32.xml"); @@ -334,6 +336,7 @@ /// /// </summary> [Test] + [ExpectedException(typeof(FatalResourceException))] public void Test33() { RunAndCompare("nist-include-33.xml", "nist-include-34.xml"); @@ -426,18 +429,22 @@ } /// <summary> - /// + /// Test a resource that contains not-well-formed XML. + /// This test should result in a fatal error. /// </summary> [Test] + [ExpectedException(typeof(XmlException))] public void Test44() { RunAndCompare("nist-include-44.xml", "nist-include-44.xml"); } /// <summary> - /// + /// Test a resource that contains not-well-formed XML. + /// This test should result in a fatal error. /// </summary> [Test] + [ExpectedException(typeof(XmlException))] public void Test45() { RunAndCompare("nist-include-45.xml", "nist-include-45.xml"); |