Bläddra i källkod

* DecoderReplacementFallbackTest.cs: Fixed DontChangeReadOnlyCodePage-
DecoderFallback test to pass on systems where codepage 932 is valid.
Assert that exception is thrown by DecoderFallback property.
* EncoderReplacementFallbackTest.cs: Fixed DontChangeReadOnlyCodePage-
EncoderFallback test to pass on systems where codepage 932 is valid.
Assert that exception is thrown by EncoderFallback property.

svn path=/trunk/mcs/; revision=81463

Gert Driesen 18 år sedan
förälder
incheckning
decc14ec8d

+ 9 - 0
mcs/class/corlib/Test/System.Text/ChangeLog

@@ -1,3 +1,12 @@
+2007-07-06  Gert Driesen  <[email protected]>
+
+	* DecoderReplacementFallbackTest.cs: Fixed DontChangeReadOnlyCodePage-
+	DecoderFallback test to pass on systems where codepage 932 is valid.
+	Assert that exception is thrown by DecoderFallback property.
+	* EncoderReplacementFallbackTest.cs: Fixed DontChangeReadOnlyCodePage-
+	EncoderFallback test to pass on systems where codepage 932 is valid.
+	Assert that exception is thrown by EncoderFallback property.
+
 2007-04-19  Marek Habersack  <[email protected]>
 
 	* DecoderReplacementFallbackTest.cs: expect the correct

+ 9 - 3
mcs/class/corlib/Test/System.Text/DecoderReplacementFallbackTest.cs

@@ -56,11 +56,17 @@ namespace MonoTests.System.Text
 		}
 
 		[Test]
-		[ExpectedException (typeof (NotSupportedException))]
 		public void DontChangeReadOnlyCodePageDecoderFallback ()
 		{
-			Encoding.GetEncoding (932).DecoderFallback =
-				new DecoderReplacementFallback ();
+			Encoding encoding = Encoding.GetEncoding (Encoding.Default.CodePage);
+			try {
+				encoding.DecoderFallback = new DecoderReplacementFallback ();
+				Assert.Fail ("#1");
+			} catch (InvalidOperationException ex) {
+				Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
+				Assert.IsNull (ex.InnerException, "#3");
+				Assert.IsNotNull (ex.Message, "#4");
+			}
 		}
 
 		[Test]

+ 9 - 3
mcs/class/corlib/Test/System.Text/EncoderReplacementFallbackTest.cs

@@ -56,11 +56,17 @@ namespace MonoTests.System.Text
 		}
 
 		[Test]
-		[ExpectedException (typeof (NotSupportedException))]
 		public void DontChangeReadOnlyCodePageEncoderFallback ()
 		{
-			Encoding.GetEncoding (932).EncoderFallback =
-				new EncoderReplacementFallback ();
+			Encoding encoding = Encoding.GetEncoding (Encoding.Default.CodePage);
+			try {
+				encoding.EncoderFallback = new EncoderReplacementFallback ();
+				Assert.Fail ("#1");
+			} catch (InvalidOperationException ex) {
+				Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
+				Assert.IsNull (ex.InnerException, "#3");
+				Assert.IsNotNull (ex.Message, "#4");
+			}
 		}
 
 		[Test]