Merge pull request #200 from ch5oh/master
[mono.git] / mcs / class / corlib / Test / System / DoubleFormatterTest.cs
index 551b816c984b700fccf89ac7e0c4e3bfe07ba3d3..bfed360755f7593c9e480f37053bcc46d83f966d 100644 (file)
@@ -10,11 +10,26 @@ using System;
 using System.Threading;
 using System.Globalization;
 
-namespace MonoTests.System {
-       
+namespace MonoTests.System 
+{
        [TestFixture]
-       public class DoubleFormatterTest : Assertion
+       public class DoubleFormatterTest 
        {
+               CultureInfo old_culture;
+
+               [SetUp]
+               public void SetUp ()
+               {
+                       old_culture = Thread.CurrentThread.CurrentCulture;
+                       Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-US", false);
+               }
+
+               [TearDown]
+               public void TearDown ()
+               {
+                       Thread.CurrentThread.CurrentCulture = old_culture;
+               }
+
                [Test]
                [ExpectedException(typeof(FormatException))]
                public void TestToDecimal()
@@ -41,7 +56,7 @@ namespace MonoTests.System {
                
                private void FormatStringTest(string TestNumber, NumberFormatInfo NumberFormat, double Number, string Format, string ExpectedResult)
                {
-                       Assertion.AssertEquals (TestNumber, ExpectedResult, Number.ToString(Format, NumberFormat));                                
+                       Assert.AreEqual (ExpectedResult, Number.ToString(Format, NumberFormat), TestNumber);
                }
 
                private NumberFormatInfo GetNumberFormat1()
@@ -924,7 +939,7 @@ namespace MonoTests.System {
                public void NonStandardRounding () 
                {
                        // banker's rounding would results in 2.71828182845904
-                       AssertEquals ("G-E", "2.71828182845905", Math.E.ToString (CultureInfo.InvariantCulture));
+                       Assert.AreEqual ("2.71828182845905", Math.E.ToString (CultureInfo.InvariantCulture), "G-E");
                }
 
                // see bug #60110 for more details
@@ -932,7 +947,7 @@ namespace MonoTests.System {
                public void Roundtrip_ExactStringFormat () 
                {
                        // here we check that the "R" output is "extactly" the same as MS implementation
-                       AssertEquals ("R-E", "2.7182818284590451", Math.E.ToString ("R", CultureInfo.InvariantCulture));
+                       Assert.AreEqual ("2.7182818284590451", Math.E.ToString ("R", CultureInfo.InvariantCulture), "R-E");
                }
 
                // see bug #60110 for more details
@@ -942,17 +957,17 @@ namespace MonoTests.System {
                        // here we check that we can recreate the "extact" same double from the "R" format
                        string se = Math.E.ToString ("R", CultureInfo.InvariantCulture);
                        Double de = Double.Parse (se);
-                       AssertEquals ("E==E", Math.E, de);
+                       Assert.AreEqual (Math.E, de, "E==E");
 
                        // we try Mono "long" R format
                        se = "2.718281828459045090795598298427648842334747314453125";
                        de = Double.Parse (se);
-                       AssertEquals ("Mono==E", Math.E, de);
+                       Assert.AreEqual (Math.E, de, "Mono==E");
 
                        // we try MS "short" R format
                        se = "2.7182818284590451";
                        de = Double.Parse (se);
-                       AssertEquals ("Microsoft==E", Math.E, de);
+                       Assert.AreEqual (Math.E, de, "Microsoft==E");
                }
 
                [Test]
@@ -962,7 +977,7 @@ namespace MonoTests.System {
                        // here we check that we can recreate the "extact" same double from the "R" format
                        string se = value.ToString ("R", CultureInfo.InvariantCulture);
                        Double de = Double.Parse (se);
-                       AssertEquals ("-E==-E", value, de);
+                       Assert.AreEqual (value, de, "-E==-E");
                }
        }
 }