Pārlūkot izejas kodu

2010-06-30 Atsushi Enomoto <[email protected]>

	* XmlWriterTests.cs : more notes and tests.


svn path=/trunk/mcs/; revision=159706
Atsushi Eno 15 gadi atpakaļ
vecāks
revīzija
f0c4bb76e4

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

@@ -1,3 +1,7 @@
+2010-06-30  Atsushi Enomoto  <[email protected]>
+
+	* XmlWriterTests.cs : more notes and tests.
+
 2010-06-30  Atsushi Enomoto  <[email protected]>
 
 	* XmlWriterTests.cs : refine failure conditions.

+ 53 - 18
mcs/class/System.XML/Test/System.Xml/XmlWriterTests.cs

@@ -576,25 +576,29 @@ namespace MonoTests.System.Xml
 		}
 
 		//
-		// Reader      | wrapper   |
-		// overrides   | argument  | sample
+		// Reader      |wrapper| result |checks state (and err)
+		// overrides   |       |        | |test name
 		// ------------+--------------------------
-		//      -      |     -     | CreateNOCL
-		//             | Auto      | CreateNOCLSettingsCLAuto
-		//             | Document  | CreateNOCLSettingsCLDoc
-		//             | Fragment  | CreateNOCLSettingsCLFrag
-		// Auto        |     -     | CreateCLAuto
-		//             | Auto      |  -
-		//             | Document  | CreateCLAutoSettingsCLDoc
-		//             | Fragment  | CreateCLAutoSettingsCLFrag
-		// Document    |     -     | CreateCLDoc
-		//             | Auto      | CreateCLDocSettingsCLAuto
-		//             | Document  |  -
-		//             | Fragment  | CreateCLDocSettingsCLFrag
-		// Fragment    |     -     | CreateCLFlag
-		//             | Auto      | CreateCLFragSettingsCLAuto
-		//             | Document  | CreateCLFragSettingsCLDoc
-		//             | Fragment  |  -
+		//      -      |   -   | Doc    |x| CreateNOCL
+		//             | Auto  | Doc    |x| CreateNOCLSettingsCLAuto
+		//             | Doc   | Doc    |x| CreateNOCLSettingsCLDoc
+		//             | Frag  | Doc    |x| CreateNOCLSettingsCLFrag
+		// Auto        |   -   | Doc    | | CreateCLAuto
+		//             | Auto  | Auto(!)|x| CreateCLAutoSettingsCLAuto
+		//             | Doc   | Doc    | | CreateCLAutoSettingsCLDoc
+		//             | Frag  | Frag   | | CreateCLAutoSettingsCLFrag
+		// Document    |   -   | Doc    |x| CreateCLDoc
+		//             | Auto  | Doc    |x| CreateCLDocSettingsCLAuto
+		//             | Doc   |        |x| CreateCLDocSettingsCLDoc
+		//             | Frag  | Frag   | | CreateCLDocSettingsCLFrag
+		// Fragment    |   -   | Doc    | | CreateCLFrag
+		//             | Auto  | Frag   |x| CreateCLFragSettingsCLAuto
+		//             | Doc   | Doc    | | CreateCLFragSettingsCLDoc
+		//             | Frag  | Frag   |x| CreateCLFragSettingsCLFrag
+		//
+		// What we can see from above:
+		// - default ConformanceLevel is Document.
+		// - Auto can happen only if both inputs are Auto
 		//
 
 		[Test]
@@ -669,6 +673,16 @@ namespace MonoTests.System.Xml
 			WriteState state = xw.WriteState;
 		}
 
+		[Test]
+		[ExpectedException (typeof (InvalidOperationException))]
+		public void CreateCLAutoSettingsCLAuto ()
+		{
+			ConformanceLevelAuto cl = new ConformanceLevelAuto ();
+			XmlWriter xw = XmlWriter.Create (cl, new XmlWriterSettings () { ConformanceLevel = ConformanceLevel.Auto });
+			Assert.AreEqual (ConformanceLevel.Auto, xw.Settings.ConformanceLevel, "#1");
+			WriteState state = xw.WriteState;
+		}
+
 		[Test]
 		[Category ("NotWorking")]
 		public void CreateCLAutoSettingsCLDoc ()
@@ -699,6 +713,17 @@ namespace MonoTests.System.Xml
 			WriteState state = xw.WriteState;
 		}
 
+		[Test]
+		[ExpectedException (typeof (InvalidOperationException))]
+		[Category ("NotWorking")]
+		public void CreateCLDocSettingsCLDoc ()
+		{
+			ConformanceLevelDocument cl = new ConformanceLevelDocument ();
+			XmlWriter xw = XmlWriter.Create (cl, new XmlWriterSettings () { ConformanceLevel = ConformanceLevel.Document });
+			Assert.AreEqual (ConformanceLevel.Document, xw.Settings.ConformanceLevel, "#1");
+			WriteState state = xw.WriteState;
+		}
+
 		[Test]
 		[Category ("NotWorking")]
 		public void CreateCLDocSettingsCLFrag ()
@@ -729,6 +754,16 @@ namespace MonoTests.System.Xml
 			WriteState state = xw.WriteState;
 		}
 
+		[Test]
+		[ExpectedException (typeof (InvalidOperationException))]
+		public void CreateCLFragSettingsCLFrag ()
+		{
+			ConformanceLevelFragment cl = new ConformanceLevelFragment ();
+			XmlWriter xw = XmlWriter.Create (cl, new XmlWriterSettings () { ConformanceLevel = ConformanceLevel.Fragment });
+			Assert.AreEqual (ConformanceLevel.Fragment, xw.Settings.ConformanceLevel, "#1");
+			WriteState state = xw.WriteState;
+		}
+
 #endif
 
 	}