Make System.Drawing unit tests use Assert.Throws instead of [ExpectedException] ...
[mono.git] / mcs / class / System.Drawing / Test / System.Drawing.Drawing2D / TestMatrix.cs
index 4907c5b21e0126e9e201735f50c179e3c8a33c59..e95e81be01d005867f414a16a6cef12601d92be9 100644 (file)
@@ -83,24 +83,21 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Int_Null ()
                {
-                       new Matrix (rect, null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix (rect, null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Int_Empty ()
                {
-                       new Matrix (rect, new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix (rect, new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Int_4Point ()
                {
-                       new Matrix (rect, new Point[4]);
+                       Assert.Throws<ArgumentException> (() => new Matrix (rect, new Point[4]));
                }
 
                [Test]
@@ -118,24 +115,21 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Constructor_Float_Null ()
                {
-                       new Matrix (rectf, null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix (rectf, null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Float_Empty ()
                {
-                       new Matrix (rectf, new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix (rectf, new PointF[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Constructor_Float_2PointF ()
                {
-                       new Matrix (rectf, new PointF[2]);
+                       Assert.Throws<ArgumentException> (() => new Matrix (rectf, new PointF[2]));
                }
 
                [Test]
@@ -332,10 +326,9 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Rotate_InvalidOrder ()
                {
-                       new Matrix ().Rotate (180, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().Rotate (180, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
@@ -353,17 +346,15 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void RotateAt_InvalidOrder ()
                {
-                       new Matrix ().RotateAt (180, new PointF (10, 10), (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().RotateAt (180, new PointF (10, 10), (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Multiply_Null ()
                {
-                       new Matrix (10, 20, 30, 40, 50, 60).Multiply (null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix (10, 20, 30, 40, 50, 60).Multiply (null));
                }
 
                [Test]
@@ -381,10 +372,9 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void Multiply_Null_Order ()
                {
-                       new Matrix (10, 20, 30, 40, 50, 60).Multiply (null, MatrixOrder.Append);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix (10, 20, 30, 40, 50, 60).Multiply (null, MatrixOrder.Append));
                }
 
                [Test]
@@ -416,11 +406,10 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Multiply_InvalidOrder ()
                {
                        Matrix matrix = new Matrix (10, 20, 30, 40, 50, 60);
-                       matrix.Multiply (new Matrix (10, 20, 30, 40, 50, 60), (MatrixOrder)Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => matrix.Multiply (new Matrix (10, 20, 30, 40, 50, 60), (MatrixOrder)Int32.MinValue));
                }
 
                [Test]
@@ -513,10 +502,9 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Scale_InvalidOrder ()
                {
-                       new Matrix ().Scale (2, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().Scale (2, 1, (MatrixOrder) Int32.MinValue));
                }
                
                [Test]
@@ -544,10 +532,9 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Shear_InvalidOrder ()
                {
-                       new Matrix ().Shear (-1, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().Shear (-1, 1, (MatrixOrder) Int32.MinValue));
                }
                
                [Test]
@@ -571,31 +558,27 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void TransformPoints_Point_Null ()
                {
-                       new Matrix ().TransformPoints ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformPoints ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void TransformPoints_PointF_Null ()
                {
-                       new Matrix ().TransformPoints ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformPoints ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TransformPoints_Point_Empty ()
                {
-                       new Matrix ().TransformPoints (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().TransformPoints (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TransformPoints_PointF_Empty ()
                {
-                       new Matrix ().TransformPoints (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().TransformPoints (new PointF[0]));
                }
                
                [Test]
@@ -619,31 +602,27 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void TransformVectors_Point_Null ()
                {
-                       new Matrix ().TransformVectors ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformVectors ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void TransformVectors_PointF_Null ()
                {
-                       new Matrix ().TransformVectors ((PointF[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix ().TransformVectors ((PointF[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TransformVectors_Point_Empty ()
                {
-                       new Matrix ().TransformVectors (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().TransformVectors (new Point[0]));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void TransformVectors_PointF_Empty ()
                {
-                       new Matrix ().TransformVectors (new PointF[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().TransformVectors (new PointF[0]));
                }
 
                [Test]
@@ -661,24 +640,21 @@ namespace MonoTests.System.Drawing.Drawing2D
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void Translate_InvalidOrder ()
                {
-                       new Matrix ().Translate (-1, 1, (MatrixOrder) Int32.MinValue);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().Translate (-1, 1, (MatrixOrder) Int32.MinValue));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentNullException))]
                public void VectorTransformPoints_Null ()
                {
-                       new Matrix ().VectorTransformPoints ((Point[]) null);
+                       Assert.Throws<ArgumentNullException> (() => new Matrix ().VectorTransformPoints ((Point[]) null));
                }
 
                [Test]
-               [ExpectedException (typeof (ArgumentException))]
                public void VectorTransformPoints_Empty ()
                {
-                       new Matrix ().VectorTransformPoints (new Point[0]);
+                       Assert.Throws<ArgumentException> (() => new Matrix ().VectorTransformPoints (new Point[0]));
                }
        }
 }