Make System.Drawing unit tests use Assert.Throws instead of [ExpectedException] ...
[mono.git] / mcs / class / System.Drawing / Test / System.Drawing.Drawing2D / GraphicsPathTest.cs
index e8232565933069b1ed8408c17cd52091a0462042..9674c311abbd4f19156908c4fa3b2d4bc7427100 100644 (file)
@@ -59,45 +59,39 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Point_Null_Byte ()
                {
-                       new GraphicsPath ((Point[]) null, new byte[1]);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ((Point[]) null, new byte[1]));
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Constructor_Point_Byte_Null ()
                {
-                       new GraphicsPath (new Point[1], null);
+                       Assert.Throws<NullReferenceException> (() => new GraphicsPath (new Point[1], null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Point_Byte_LengthMismatch ()
                {
-                       new GraphicsPath (new Point[1], new byte [2]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath (new Point[1], new byte [2]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_PointF_Null_Byte ()
                {
-                       new GraphicsPath ((PointF[])null, new byte [1]);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ((PointF[])null, new byte [1]));
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void Constructor_PointF_Byte_Null ()
                {
-                       new GraphicsPath ( new PointF[1], null);
+                       Assert.Throws<NullReferenceException> (() => new GraphicsPath ( new PointF[1], null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_PointF_Byte_LengthMismatch ()
                {
-                       new GraphicsPath (new PointF[2], new byte [1]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath (new PointF[2], new byte [1]));
                }
 
                [Test]
@@ -116,17 +110,15 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void GraphicsPath_Empty_PathPoints ()
                {
-                       Assert.IsNull (new GraphicsPath ().PathPoints);
+                       Assert.Throws<ArgumentException> (() => Assert.IsNull (new GraphicsPath ().PathPoints));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void GraphicsPath_Empty_PathTypes ()
                {
-                       Assert.IsNull (new GraphicsPath ().PathTypes);
+                       Assert.Throws<ArgumentException> (() => Assert.IsNull (new GraphicsPath ().PathTypes));
                }
 
                [Test]
@@ -172,14 +164,13 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (SC.InvalidEnumArgumentException))]
                public void FillMode_Invalid ()
                {
                        // constructor accept an invalid FillMode
                        GraphicsPath gp = new GraphicsPath ((FillMode) Int32.MaxValue);
                        Assert.AreEqual (Int32.MaxValue, (int) gp.FillMode, "MaxValue");
                        // but you can't set the FillMode property to an invalid value ;-)
-                       gp.FillMode = (FillMode) Int32.MaxValue;
+                       Assert.Throws<SC.InvalidEnumArgumentException> (() => gp.FillMode = (FillMode) Int32.MaxValue);
                }
 
                [Test]
@@ -388,18 +379,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddBeziers_Point_Null ()
                {
-                       new GraphicsPath ().AddBeziers ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddBeziers ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddBeziers_3_Points ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddBeziers (new Point[3] { new Point (1, 1), new Point (2, 2), new Point (3, 3) });
+                       Assert.Throws<ArgumentException> (() => gp.AddBeziers (new Point[3] { new Point (1, 1), new Point (2, 2), new Point (3, 3) }));
                }
 
                [Test]
@@ -411,18 +400,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddBeziers_PointF_Null ()
                {
-                       new GraphicsPath ().AddBeziers ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddBeziers ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddBeziers_3_PointFs ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddBeziers (new PointF[3] { new PointF (1f, 1f), new PointF (2f, 2f), new PointF (3f, 3f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddBeziers (new PointF[3] { new PointF (1f, 1f), new PointF (2f, 2f), new PointF (3f, 3f) }));
                }
 
                [Test]
@@ -641,19 +628,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddLines_Point_Null ()
                {
-                       new GraphicsPath ().AddLines ((Point[])null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddLines ((Point[])null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddLines_Point_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddLines (new Point[0]);
-                       CheckLine (gp);
+                       Assert.Throws<ArgumentException> (() => gp.AddLines (new Point[0]));
                }
 
                [Test]
@@ -675,19 +659,16 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddLines_PointF_Null ()
                {
-                       new GraphicsPath ().AddLines ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddLines ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddLines_PointF_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddLines (new PointF[0]);
-                       CheckLine (gp);
+                       Assert.Throws<ArgumentException> (() => gp.AddLines (new PointF[0]));
                }
 
                [Test]
@@ -846,33 +827,29 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddPolygon_Point_Null ()
                {
-                       new GraphicsPath ().AddPolygon ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddPolygon ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_Point_Empty ()
                {
-                       new GraphicsPath ().AddPolygon (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath ().AddPolygon (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_Point_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new Point[1] { new Point (1, 1) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new Point[1] { new Point (1, 1) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_Point_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new Point[2] { new Point (1, 1), new Point (2, 2) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new Point[2] { new Point (1, 1), new Point (2, 2) }));
                }
 
                [Test]
@@ -884,33 +861,29 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddPolygon_PointF_Null ()
                {
-                       new GraphicsPath ().AddPolygon ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddPolygon ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_PointF_Empty ()
                {
-                       new GraphicsPath ().AddPolygon (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath ().AddPolygon (new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_PointF_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new PointF[1] { new PointF (1f, 1f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new PointF[1] { new PointF (1f, 1f) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddPolygon_PointF_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddPolygon (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddPolygon (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }));
                }
 
                [Test]
@@ -1084,20 +1057,17 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddRectangles_Int_Null ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles ((Rectangle[]) null);
+                       Assert.Throws<ArgumentNullException> (() => gp.AddRectangles ((Rectangle[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddRectangles_Int_Empty ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles (new Rectangle[0]);
-                       CheckRectangle (gp, 4);
+                       Assert.Throws<ArgumentException> (() => gp.AddRectangles (new Rectangle[0]));
                }
 
                [Test]
@@ -1109,20 +1079,17 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddRectangles_Float_Null ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles ((RectangleF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => gp.AddRectangles ((RectangleF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddRectangles_Float_Empty ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddRectangles ( new RectangleF[0]);
-                       CheckRectangle (gp, 4);
+                       Assert.Throws<ArgumentException> (() => gp.AddRectangles ( new RectangleF[0]));
                }
 
                [Test]
@@ -1163,10 +1130,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddPath_Null ()
                {
-                       new GraphicsPath ().AddPath (null, false);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddPath (null, false));
                }
 
                [Test]
@@ -1199,34 +1165,30 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddClosedCurve_Point_Null ()
                {
-                       new GraphicsPath ().AddClosedCurve ((Point[])null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddClosedCurve ((Point[])null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_Point_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new Point [0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new Point [0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_Point_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new Point[1] { new Point (1, 1) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new Point[1] { new Point (1, 1) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_Point_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new Point[2] { new Point (1, 1), new Point (2, 2) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new Point[2] { new Point (1, 1), new Point (2, 2) }));
                }
 
                [Test]
@@ -1238,34 +1200,30 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddClosedCurve_PointF_Null ()
                {
-                       new GraphicsPath ().AddClosedCurve ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddClosedCurve ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_PointF_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_PointF_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new PointF[1] { new PointF (1f, 1f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new PointF[1] { new PointF (1f, 1f) }));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddClosedCurve_PointF_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddClosedCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddClosedCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }));
                }
 
                [Test]
@@ -1332,26 +1290,23 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddCurve_Point_Null ()
                {
-                       new GraphicsPath ().AddCurve ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddCurve ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_Point_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_Point_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new Point[1] { new Point (1, 1) });
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new Point[1] { new Point (1, 1) }));
                }
 
                [Test]
@@ -1375,35 +1330,31 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve3_Point_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new Point[2] { new Point (1, 1), new Point (2, 2) }, 0, 2, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new Point[2] { new Point (1, 1), new Point (2, 2) }, 0, 2, 0.5f));
                        // adding only two points isn't supported by GdipAddCurve3I
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void AddCurve_PointF_Null ()
                {
-                       new GraphicsPath ().AddCurve ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().AddCurve ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_PointF_0 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_PointF_1 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[1] { new PointF (1f, 1f) });
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[1] { new PointF (1f, 1f) }));
                }
 
                [Test]
@@ -1427,11 +1378,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve3_PointF_2 ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 2, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 2, 0.5f));
                        // adding only two points isn't supported by GdipAddCurve3
                }
 
@@ -1445,27 +1395,24 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_ZeroSegments ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 0, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, 0, 0.5f));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_NegativeSegments ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, -1, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[2] { new PointF (1f, 1f), new PointF (2f, 2f) }, 0, -1, 0.5f));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddCurve_OffsetTooLarge ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddCurve (new PointF[3] { new PointF (1f, 1f), new PointF (0f, 20f), new PointF (20f, 0f) }, 1, 2, 0.5f);
+                       Assert.Throws<ArgumentException> (() => gp.AddCurve (new PointF[3] { new PointF (1f, 1f), new PointF (0f, 20f), new PointF (20f, 0f) }, 1, 2, 0.5f));
                }
 
                [Test]
@@ -1572,12 +1519,11 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (NullReferenceException))]
                public void AddString_NullString ()
                {
                        GraphicsPath gp = new GraphicsPath ();
                        FontFamily ff = GetFontFamily ();
-                       gp.AddString (null, ff, 0, 10, new Point (10, 10), StringFormat.GenericDefault);
+                       Assert.Throws<NullReferenceException> (() => gp.AddString (null, ff, 0, 10, new Point (10, 10), StringFormat.GenericDefault));
                }
 
                [Test]
@@ -1590,11 +1536,10 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void AddString_NullFontFamily ()
                {
                        GraphicsPath gp = new GraphicsPath ();
-                       gp.AddString ("mono", null, 0, 10, new Point (10, 10), StringFormat.GenericDefault);
+                       Assert.Throws<ArgumentException> (() => gp.AddString ("mono", null, 0, 10, new Point (10, 10), StringFormat.GenericDefault));
                }
 
                [Test]
@@ -1779,10 +1724,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Transform_Null ()
                {
-                       new GraphicsPath ().Transform (null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Transform (null));
                }
                [Test]
                public void Transform_Empty ()
@@ -1976,17 +1920,15 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Warp_Null ()
                {
-                       new GraphicsPath ().Warp (null, new RectangleF ());
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Warp (null, new RectangleF ()));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Warp_NoPoints ()
                {
-                       new GraphicsPath ().Warp (new PointF[0], new RectangleF ());
+                       Assert.Throws<ArgumentException> (() => new GraphicsPath ().Warp (new PointF[0], new RectangleF ()));
                }
 
                [Test]
@@ -2461,10 +2403,9 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Widen_Pen_Null ()
                {
-                       new GraphicsPath ().Widen (null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Widen (null));
                }
 
                [Test]
@@ -2520,16 +2461,12 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Widen_Pen_Null_Matrix ()
                {
-                       new GraphicsPath ().Widen (null, new Matrix ());
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().Widen (null, new Matrix ()));
                }
 
                [Test]
-#if ONLY_1_1
-               [ExpectedException (typeof (OutOfMemoryException))]
-#endif
                public void Widen_NoPoint ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
@@ -2541,14 +2478,13 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (OutOfMemoryException))]
                public void Widen_SinglePoint ()
                {
                        using (GraphicsPath gp = new GraphicsPath ()) {
                                gp.AddLines (new Point[1] { new Point (1, 1) });
                                // Special case - a line with a single point is valid
                                Assert.AreEqual (1, gp.PointCount, "PointCount");
-                               gp.Widen (Pens.Red);
+                               Assert.Throws<OutOfMemoryException> (() => gp.Widen (Pens.Red));
                                // oops ;-)
                        }
                }
@@ -2672,31 +2608,27 @@ namespace MonoTests.System.Drawing.Drawing2D {
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_IntNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (1, 1, null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (1, 1, null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_FloatNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (1.0f, 1.0f, null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (1.0f, 1.0f, null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_PointNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (new Point (), null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (new Point (), null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void IsOutlineVisible_PointFNull ()
                {
-                       new GraphicsPath ().IsOutlineVisible (new PointF (), null);
+                       Assert.Throws<ArgumentNullException> (() => new GraphicsPath ().IsOutlineVisible (new PointF (), null));
                }
 
                private void IsOutlineVisible_Line (Graphics graphics)