Merge pull request #1057 from lextm/master
[mono.git] / mcs / class / corlib / Test / System.Diagnostics / StackFrameTest.cs
index 867bb39272f2eef0638f039635e3b2f394a21f26..adec97c3ead35728d07f9120fe70c2ecbc1923c4 100644 (file)
@@ -19,7 +19,7 @@ namespace MonoTests.System.Diagnostics
        /// location inside it.
        /// </summary>
        [TestFixture]
-       public class StackFrameTest1 : Assertion
+       public class StackFrameTest1
        {
                private StackFrame frame1;
                private StackFrame frame2;
@@ -42,30 +42,32 @@ namespace MonoTests.System.Diagnostics
                ///   Tests whether getting file name works.
                /// </summary>
                [Test]
+               [Category("LLVMNotWorking")]
                public void TestGetFileName ()
                {
-                       AssertEquals ("File name (1)",
-                                                "dir/someFile",
-                                                frame1.GetFileName ());
+                       Assert.AreEqual ("dir/someFile",
+                                                frame1.GetFileName (),
+                                                "File name (1)");
 
-                       AssertEquals ("File name (2)",
-                                                "SomeFile2.cs",
-                                                frame2.GetFileName ());
+                       Assert.AreEqual ("SomeFile2.cs",
+                                                frame2.GetFileName (),
+                                                "File name (2)");
                }
 
                /// <summary>
                /// Tests whether getting file line number works.
                /// </summary>
                [Test]
+               [Category("LLVMNotWorking")]
                public void TestGetFileLineNumber ()
                {
-                       AssertEquals ("Line number (1)",
-                                                13,
-                                                frame1.GetFileLineNumber ());
+                       Assert.AreEqual (13,
+                                                        frame1.GetFileLineNumber (),
+                                                        "Line number (1)");
 
-                       AssertEquals ("Line number (2)",
-                                                24,
-                                                frame2.GetFileLineNumber ());
+                       Assert.AreEqual (24,
+                                                        frame2.GetFileLineNumber (),
+                                                        "Line number (2)");
                }
 
                /// <summary>
@@ -74,13 +76,13 @@ namespace MonoTests.System.Diagnostics
                [Test]
                public void TestGetFileColumnNumber ()
                {
-                       AssertEquals ("Column number (1)",
-                                                45,
-                                                frame1.GetFileColumnNumber ());
+                       Assert.AreEqual (45,
+                                                        frame1.GetFileColumnNumber (),
+                                                        "Column number (1)");
 
-                       AssertEquals ("Column number (2)",
-                                                0,
-                                                frame2.GetFileColumnNumber ());
+                       Assert.AreEqual (0,
+                                                        frame2.GetFileColumnNumber (),
+                                                        "Column number (2)");
                }
 
                /// <summary>
@@ -89,23 +91,23 @@ namespace MonoTests.System.Diagnostics
                [Test]
                public void TestGetMethod ()
                {
-                       Assert ("Method not null (1)", (frame1.GetMethod () != null));
-
-                       AssertEquals ("Class declaring the method (1)",
-                                                this.GetType (),
-                                                frame1.GetMethod ().DeclaringType);
-                       AssertEquals ("Method name (1)",
-                                                "SetUp",
-                                                frame1.GetMethod ().Name);
-
-                       Assert ("Method not null (2)", (frame2.GetMethod () != null));
-
-                       AssertEquals ("Class declaring the method (2)",
-                                                this.GetType (),
-                                                frame2.GetMethod ().DeclaringType);
-                       AssertEquals ("Method name (2)",
-                                                "SetUp",
-                                                frame2.GetMethod ().Name);
+                       Assert.IsTrue ((frame1.GetMethod () != null), "Method not null (1)");
+
+                       Assert.AreEqual (this.GetType (),
+                                                        frame1.GetMethod ().DeclaringType,
+                                                        "Class declaring the method (1)");
+                       Assert.AreEqual ("SetUp",
+                                                        frame1.GetMethod ().Name,
+                                                        "Method name (1)");
+
+                       Assert.IsTrue ((frame2.GetMethod () != null), "Method not null (2)");
+
+                       Assert.AreEqual (this.GetType (),
+                                                        frame2.GetMethod ().DeclaringType,
+                                                        "Class declaring the method (2)");
+                       Assert.AreEqual ("SetUp",
+                                                        frame2.GetMethod ().Name,
+                                                        "Method name (2)");
                }
        }
 
@@ -119,7 +121,7 @@ namespace MonoTests.System.Diagnostics
        /// debug information?
        /// </remarks>
        [TestFixture]
-       public class StackFrameTest2 : Assertion
+       public class StackFrameTest2
        {
                private StackFrame frame1;
                private StackFrame frame2;
@@ -147,37 +149,44 @@ namespace MonoTests.System.Diagnostics
                [Test]
                public void TestGetFileName1 ()
                {
-                       AssertNull ("File name (1)",
-                                          frame1.GetFileName ());
+                       Assert.IsNull (frame1.GetFileName (),
+                                                  "File name (1)");
                }
 
                [Test]
+               [Category ("LLVMNotWorking")]
                public void TestGetFileName2 ()
                {
-                       AssertNotNull ("File name not null", frame2.GetFileName ());
-                       Assert ("File name not empty", frame2.GetFileName ().Length != 0);
-                       Assert ("File name (2) " + frame2.GetFileName ()
-                                                       + " ends with StackFrameTest.cs",
-                                  frame2.GetFileName ().EndsWith ("StackFrameTest.cs"));
+#if MOBILE && !DEBUG
+                       Assert.Ignore ("The .mdb file won't be present inside the app and no file name will be available");
+#endif
+                       Assert.IsNotNull (frame2.GetFileName (), "File name not null");
+                       Assert.IsTrue (frame2.GetFileName ().Length != 0, "File name not empty");
+                       Assert.IsTrue (frame2.GetFileName ().EndsWith ("StackFrameTest.cs"),
+                                                  "File name (2) " + frame2.GetFileName () + " ends with StackFrameTest.cs");
                }
 
                /// <summary>
                /// Tests whether getting file line number works.
                /// </summary>
                [Test]
+               [Category ("LLVMNotWorking")]
                public void TestGetFileLineNumber ()
                {
-                       AssertEquals ("Line number (1)",
-                                                0,
-                                                frame1.GetFileLineNumber ());
+#if MOBILE && !DEBUG
+                       Assert.Ignore ("The .mdb file won't be present inside the app and no line number will be available");
+#endif
+                       Assert.AreEqual (0,
+                                                        frame1.GetFileLineNumber (),
+                                                        "Line number (1)");
 
-                       AssertEquals ("Line number (2)",
-                                                132,
-                                                frame2.GetFileLineNumber ());
+                       Assert.AreEqual (134,
+                                                        frame2.GetFileLineNumber (),
+                                                        "Line number (2)");
 
-                       AssertEquals ("Line number (3)",
-                                                0,
-                                                frame3.GetFileLineNumber ());
+                       Assert.AreEqual (0,
+                                                        frame3.GetFileLineNumber (),
+                                                        "Line number (3)");
                }
 
                /// <summary>
@@ -187,17 +196,17 @@ namespace MonoTests.System.Diagnostics
                [Category ("NotWorking")] // bug #45730 - Column numbers always zero
                public void TestGetFileColumnNumber ()
                {
-                       AssertEquals ("Column number (1)",
-                                                0,
-                                                frame1.GetFileColumnNumber ());
+                       Assert.AreEqual (0,
+                                                        frame1.GetFileColumnNumber (),
+                                                        "Column number (1)");
 
-                       AssertEquals ("Column number (2)",
-                                                4,
-                                                frame2.GetFileColumnNumber ());
+                       Assert.AreEqual (4,
+                                                        frame2.GetFileColumnNumber (),
+                                                        "Column number (2)");
 
-                       AssertEquals ("Column number (3)",
-                                                0,
-                                                frame3.GetFileColumnNumber ());
+                       Assert.AreEqual (0,
+                                                        frame3.GetFileColumnNumber (),
+                                                        "Column number (3)");
                }
 
                /// <summary>
@@ -206,35 +215,35 @@ namespace MonoTests.System.Diagnostics
                [Test]
                public void TestGetMethod ()
                {
-                       Assert ("Method not null (1)",
-                                  (frame1.GetMethod () != null));
-
-                       AssertEquals ("Class declaring the method (1)",
-                                                this.GetType (),
-                                                frame1.GetMethod ().DeclaringType);
-                       AssertEquals ("Method name (1)",
-                                                "SetUp",
-                                                frame1.GetMethod ().Name);
-
-                       Assert ("Method not null (2)",
-                                  (frame2.GetMethod () != null));
-
-                       AssertEquals ("Class declaring the method (2)",
-                                                this.GetType (),
-                                                frame2.GetMethod ().DeclaringType);
-                       AssertEquals ("Method name (2)",
-                                                "SetUp",
-                                                frame2.GetMethod ().Name);
-
-                       Assert ("Method not null (3)",
-                                  (frame3.GetMethod () != null));
-
-                       AssertEquals ("Class declaring the method (3)",
-                                                this.GetType (),
-                                                frame3.GetMethod ().DeclaringType);
-                       AssertEquals ("Method name (3)",
-                                                "SetUp",
-                                                frame3.GetMethod ().Name);
+                       Assert.IsNotNull (frame1.GetMethod (),
+                                                         "Method not null (1)");
+
+                       Assert.AreEqual (this.GetType (),
+                                                        frame1.GetMethod ().DeclaringType,
+                                                        "Class declaring the method (1)");
+                       Assert.AreEqual ("SetUp",
+                                                        frame1.GetMethod ().Name,
+                                                        "Method name (1)");
+
+                       Assert.IsNotNull (frame2.GetMethod (),
+                                                         "Method not null (2)");
+
+                       Assert.AreEqual (this.GetType (),
+                                                        frame2.GetMethod ().DeclaringType,
+                                                        "Class declaring the method (2)");
+                       Assert.AreEqual ("SetUp",
+                                                        frame2.GetMethod ().Name,
+                                                        "Method name (2)");
+
+                       Assert.IsNotNull (frame3.GetMethod (),
+                                                         "Method not null (3)");
+
+                       Assert.AreEqual (this.GetType (),
+                                                        frame3.GetMethod ().DeclaringType,
+                                                        "Class declaring the method (3)");
+                       Assert.AreEqual ("SetUp",
+                                                        frame3.GetMethod ().Name,
+                                                        "Method name (3)");
                }
        }
 
@@ -249,7 +258,7 @@ namespace MonoTests.System.Diagnostics
        /// debug information?
        /// </remarks>
        [TestFixture]
-       public class StackFrameTest3 : Assertion
+       public class StackFrameTest3
        {
                protected StackFrame frame1;
                protected StackFrame frame2;
@@ -281,17 +290,20 @@ namespace MonoTests.System.Diagnostics
                /// Tests whether getting file name works.
                /// </summary>
                [Test]
+               [Category ("LLVMNotWorking")]
                public void TestGetFileName ()
                {
-                       AssertNull ("File name (1)",
-                                          frame1.GetFileName ());
+#if MOBILE && !DEBUG
+                       Assert.Ignore ("The .mdb file won't be present inside the app and no file name will be available");
+#endif
+                       Assert.IsNull (frame1.GetFileName (),
+                                                  "File name (1)");
 
-                       AssertNotNull ("File name (2) should not be null",
-                                          frame2.GetFileName ());
+                       Assert.IsNotNull (frame2.GetFileName (),
+                                                         "File name (2) should not be null");
 
-                       Assert ("File name (2) " + frame2.GetFileName ()
-                                                                               + " ends with StackFrameTest.cs",
-                                                          frame2.GetFileName ().EndsWith ("StackFrameTest.cs"));
+                       Assert.IsTrue (frame2.GetFileName ().EndsWith ("StackFrameTest.cs"),
+                                                  "File name (2) " + frame2.GetFileName () + " ends with StackFrameTest.cs");
                }
 
                /// <summary>
@@ -301,15 +313,19 @@ namespace MonoTests.System.Diagnostics
 #if ONLY_1_1
                [Category ("NotDotNet")] // .NET 1.1 is off by one
 #endif
+               [Category ("LLVMNotWorking")]
                public void TestGetFileLineNumber ()
                {
-                       AssertEquals ("Line number (1)",
-                                                0,
-                                                frame1.GetFileLineNumber ());
+#if MOBILE && !DEBUG
+                       Assert.Ignore ("The .mdb file won't be present inside the app and no line number will be available");
+#endif
+                       Assert.AreEqual (0,
+                                                        frame1.GetFileLineNumber (),
+                                                        "Line number (1)");
 
-                       AssertEquals ("Line number (2)",
-                                                261,
-                                                frame2.GetFileLineNumber ());
+                       Assert.AreEqual (270,
+                                                        frame2.GetFileLineNumber (),
+                                                        "Line number (2)");
                }
 
                /// <summary>
@@ -322,13 +338,13 @@ namespace MonoTests.System.Diagnostics
                [Category ("NotWorking")] // bug #45730 - Column numbers always zero
                public void TestGetFileColumnNumber ()
                {
-                       AssertEquals ("Column number (1)",
-                                                0,
-                                                frame1.GetFileColumnNumber ());
+                       Assert.AreEqual (0,
+                                                frame1.GetFileColumnNumber (),
+                                                        "Column number (1)");
 
-                       AssertEquals ("Column number (2)",
-                                                4,
-                                                frame2.GetFileColumnNumber ());
+                       Assert.AreEqual (4,
+                                                        frame2.GetFileColumnNumber (),
+                                                        "Column number (2)");
                }
 
                /// <summary>
@@ -337,17 +353,17 @@ namespace MonoTests.System.Diagnostics
                [Test]
                public void TestGetMethod ()
                {
-                       Assert ("Method not null (1)", (frame1.GetMethod () != null));
+                       Assert.IsTrue ((frame1.GetMethod () != null), "Method not null (1)");
 
-                       Assert ("Method not null (2)", (frame2.GetMethod () != null));
+                       Assert.IsTrue ((frame2.GetMethod () != null), "Method not null (2)");
 
-                       AssertEquals ("Class declaring the method (2)",
-                                                this.GetType (),
-                                                frame2.GetMethod ().DeclaringType);
+                       Assert.AreEqual (this.GetType (),
+                                                        frame2.GetMethod ().DeclaringType,
+                                                        "Class declaring the method (2)");
 
-                       AssertEquals ("Method name (2)",
-                                                                        "SetUp",
-                                                                        frame2.GetMethod ().Name);
+                       Assert.AreEqual ("SetUp",
+                                                        frame2.GetMethod ().Name,
+                                                        "Method name (2)");
                }
        }
 }