Make System.Drawing unit tests use Assert.Throws instead of [ExpectedException] ...
[mono.git] / mcs / class / System.Drawing / Test / System.Drawing / TestPointConverter.cs
index 1732d02b6946086c010ef38f088dd9287eeab57c..7b5ec27a8576b5ffeaf3e6bb851b6bcfde840684 100644 (file)
@@ -63,9 +63,6 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-#if TARGET_JVM
-               [NUnit.Framework.Category ("NotWorking")]
-#endif
                public void TestCanConvertFrom ()
                {
                        Assert.IsTrue (ptconv.CanConvertFrom (typeof (String)), "CCF#1");
@@ -97,9 +94,6 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-#if TARGET_JVM
-               [NUnit.Framework.Category ("NotWorking")]
-#endif
                public void TestConvertFrom ()
                {
                        Assert.AreEqual (pt, (Point) ptconv.ConvertFrom (null, CultureInfo.InvariantCulture,
@@ -224,6 +218,13 @@ namespace MonoTests.System.Drawing
                        } catch (Exception e) {
                                Assert.IsTrue (e is NotSupportedException, "CT#7");
                        }
+
+                       try {
+                               // culture == null
+                               ptconv.ConvertTo (null, null, pt, typeof (string));
+                       } catch (NullReferenceException e) {
+                               Assert.Fail ("CT#8: must not throw NullReferenceException");
+                       }
                }
 
                [Test]
@@ -252,17 +253,12 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-#if NET_2_0
-               [ExpectedException (typeof (ArgumentException))]
-#else
-               [ExpectedException (typeof (NullReferenceException))]
-#endif
                public void TestCreateInstance_CaseSensitive ()
                {
                        Hashtable ht = new Hashtable ();
                        ht.Add ("x", 2);
                        ht.Add ("Y", 3);
-                       ptconv.CreateInstance (null, ht);
+                       Assert.Throws<ArgumentException> (() => ptconv.CreateInstance (null, ht));
                }
 
                [Test]
@@ -273,9 +269,6 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-#if TARGET_JVM
-               [NUnit.Framework.Category ("NotWorking")]
-#endif
                public void TestGetProperties ()
                {
                        Attribute [] attrs;
@@ -311,16 +304,12 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromInvariantString_string_exc_1 ()
                {
-                       ptconv.ConvertFromInvariantString ("1");
+                       Assert.Throws<ArgumentException> (() => ptconv.ConvertFromInvariantString ("1"));
                }
 
                [Test]
-#if TARGET_JVM
-               [NUnit.Framework.Category ("NotWorking")]
-#endif
                public void ConvertFromInvariantString_string_exc_2 ()
                {
                        try {
@@ -334,9 +323,6 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-#if TARGET_JVM
-               [NUnit.Framework.Category ("NotWorking")]
-#endif
                public void ConvertFromString_string ()
                {
                        // save current culture
@@ -353,16 +339,12 @@ namespace MonoTests.System.Drawing
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void ConvertFromString_string_exc_1 ()
                {
-                       ptconv.ConvertFromString ("1");
+                       Assert.Throws<ArgumentException> (() => ptconv.ConvertFromString ("1"));
                }
 
                [Test]
-#if TARGET_JVM
-               [NUnit.Framework.Category ("NotWorking")]
-#endif
                public void ConvertFromString_string_exc_2 ()
                {
                        try {