Przeglądaj źródła

2004-09-06 Atsushi Enomoto <[email protected]>

	* XmlTextReaderTests.cs : added ProhibitDtd().
	* XmlWriterTests.cs : added WriteNodeError().

svn path=/trunk/mcs/; revision=33423
Atsushi Eno 21 lat temu
rodzic
commit
103be5da58

+ 5 - 0
mcs/class/System.XML/Test/System.Xml/ChangeLog

@@ -1,3 +1,8 @@
+2004-09-06  Atsushi Enomoto <[email protected]>
+
+	* XmlTextReaderTests.cs : added ProhibitDtd().
+	* XmlWriterTests.cs : added WriteNodeError().
+
 2004-06-21  Atsushi Enomoto <[email protected]>
 
 	* XmlSecureResolverTests.cs : Just [Ignore] EmptyEvidenceDeniedAccess.

+ 12 - 0
mcs/class/System.XML/Test/System.Xml/XmlTextReaderTests.cs

@@ -826,5 +826,17 @@ namespace MonoTests.System.Xml
 			xtr.Namespaces = false;
 			xtr.Read ();
 		}
+
+#if NET_2_0
+		[Test]
+		[ExpectedException (typeof (XmlException))]
+		public void ProhibitDtd ()
+		{
+			XmlTextReader xtr = new XmlTextReader ("<!DOCTYPE root []><root/>", XmlNodeType.Document, null);
+			xtr.ProhibitDtd = true;
+			while (!xtr.EOF)
+				xtr.Read ();
+		}
+#endif
 	}
 }

+ 14 - 0
mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs

@@ -116,6 +116,20 @@ namespace MonoTests.System.Xml
 			xtr.Close ();
 		}
 
+		[Test]
+		[ExpectedException (typeof (XmlException))]
+		public void WriteNodeError ()
+		{
+			XmlTextReader xtr = new XmlTextReader ("<root>", XmlNodeType.Document, null);
+			xtr.Read ();
+			try {
+				xtr.Read ();
+			} catch (XmlException ex) {
+			}
+			XmlTextWriter xtw = new XmlTextWriter (new StringWriter ());
+			xtw.WriteNode (xtr, false);
+		}
+
 		[Test]
 		public void WriteSurrogateCharEntity ()
 		{