2002-11-12 Ville Palo <vi64pa@koti.soon.fi>
authorVille Palo <ville@mono-cvs.ximian.com>
Tue, 12 Nov 2002 17:02:27 +0000 (17:02 -0000)
committerVille Palo <ville@mono-cvs.ximian.com>
Tue, 12 Nov 2002 17:02:27 +0000 (17:02 -0000)
* System.Data.SqlTypes/SqlStringTest.cs: Added tests

svn path=/trunk/mcs/; revision=8953

mcs/class/System.Data/Test/ChangeLog
mcs/class/System.Data/Test/System.Data.SqlTypes/SqlStringTest.cs

index 8ef228526cc5f7047fbd84e3b3bbc7017f48dc33..5b9cea2cb510172d716d12532b9c729aeee20ba6 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-12  Ville Palo <vi64pa@koti.soon.fi>
+
+       * System.Data.SqlTypes/SqlStringTest.cs: Added tests
+       
 2002-11-10  Ville Palo <vi64pa@koti.soon.fi>
 
        * System.Data.SqlTypes/SqlStringTest.cs: Added more tests
index 2e60ae6a84fe465bf1f9744139f29e1ff8f4d1a6..35206236bd78d8c1cdaec26fc4e3fbaa8542fe78 100644 (file)
-//\r
-// SqlStringTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlString\r
-//\r
-// Ville Palo (vi64pa@koti.soon.fi)\r
-//\r
-// (C) Ville Palo 2002\r
-// \r
-\r
-using NUnit.Framework;\r
-using System;\r
-using System.Data.SqlTypes;\r
-using System.Globalization;\r
-using System.Threading;\r
-\r
-namespace MonoTests.System.Data.SqlTypes\r
-{\r
-        public class SqlStringTest : TestCase {\r
-\r
-               private SqlString Test1 = null;\r
-               private SqlString Test2 = null;\r
-               private SqlString Test3 = null;\r
-\r
-                public SqlStringTest() : base ("System.Data.SqlTypes.SqlString") {}\r
-                public SqlStringTest(string name) : base(name) {}\r
-\r
-                protected override void TearDown() {}\r
-\r
-                protected override void SetUp()\r
-               {\r
-                       Test1 = new SqlString ("First TestString");\r
-                       Test2 = new SqlString ("This is just a test SqlString");\r
-                       Test3 = new SqlString ("This is just a test SqlString");\r
-                       Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-AU");\r
-               }\r
-\r
-                public static ITest Suite {\r
-                        get {\r
-\r
-                                return new TestSuite(typeof(SqlDateTime));\r
-\r
-                        }\r
-\r
-                }\r
-\r
-\r
-\r
-                // Test constructor\r
-\r
-                public void TestCreate()\r
-\r
-                {\r
-\r
-                       // SqlString (String)\r
-                       SqlString  TestString = new SqlString ("Test");\r
-                       AssertEquals ("#A01", "Test", TestString.Value);\r
-\r
-                       // SqlString (String, int)\r
-                       TestString = new SqlString ("Test", 2057);\r
-                       AssertEquals ("#A02", 2057, TestString.LCID);\r
-\r
-                       // SqlString (int, SqlCompareOptions, byte[])\r
-                       TestString = new SqlString (2057,\r
-                                                   SqlCompareOptions.BinarySort|SqlCompareOptions.IgnoreCase,\r
-                                                   new byte [2] {123, 221});\r
-                       AssertEquals ("#A03", 2057, TestString.CompareInfo.LCID);\r
-                       \r
-                       // SqlString(string, int, SqlCompareOptions)\r
-                       TestString = new SqlString ("Test", 2057, SqlCompareOptions.IgnoreNonSpace);\r
-                       Assert ("#A04", !TestString.IsNull);\r
-                       \r
-                       // SqlString (int, SqlCompareOptions, byte[], bool)\r
-                       TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [4] {100, 100, 200, 45}, true);\r
-                       AssertEquals ("#A05", (byte)63, TestString.GetNonUnicodeBytes () [0]);\r
-                       TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, false);\r
-                       AssertEquals ("#A06", (String)"qd", TestString.Value);\r
-                       \r
-                       // SqlString (int, SqlCompareOptions, byte[], int, int)\r
-                       TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, 0, 2);\r
-                       Assert ("#A07", !TestString.IsNull);\r
-\r
-                       try {\r
-                               TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, 2, 1);\r
-                               Fail ("#A07b");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#A07c", typeof (ArgumentOutOfRangeException), e.GetType ());\r
-                       }\r
-\r
-                       try {\r
-                               TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, 0, 4);\r
-                               Fail ("#A07d");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#A07e", typeof (ArgumentOutOfRangeException), e.GetType ());\r
-                       }\r
-\r
-                       // SqlString (int, SqlCompareOptions, byte[], int, int, bool)\r
-                       TestString = new SqlString (2057, SqlCompareOptions.IgnoreCase, new byte [3] {100, 111, 50}, 1, 2, false);\r
-                       AssertEquals ("#A08", "o2", TestString.Value);\r
-                       TestString = new SqlString (2057, SqlCompareOptions.IgnoreCase, new byte [3] {123, 111, 222}, 1, 2, true);\r
-                       Assert ("#A09", !TestString.IsNull);                    \r
-                }\r
-\r
-                // Test public fields\r
-                public void TestPublicFields()\r
-                {\r
-                       // BinarySort\r
-                       AssertEquals ("#B01", 32768, SqlString.BinarySort);\r
-                       \r
-                       // IgnoreCase\r
-                       AssertEquals ("#B02", 1, SqlString.IgnoreCase);\r
-                                     \r
-                       // IgnoreKanaType\r
-                       AssertEquals ("#B03", 8, SqlString.IgnoreKanaType);\r
-\r
-                       // IgnoreNonSpace\r
-                       AssertEquals ("#B04", 2, SqlString.IgnoreNonSpace);\r
-                       \r
-                       // IgnoreWidth\r
-                       AssertEquals ("#B05", 16, SqlString.IgnoreWidth);\r
-                       \r
-                       // Null\r
-                       Assert ("#B06", SqlString.Null.IsNull);\r
-                }\r
-\r
-                // Test properties\r
-                public void TestProperties()\r
-                {\r
-                       // CompareInfo\r
-                       AssertEquals ("#C01", 3081, Test1.CompareInfo.LCID);\r
-\r
-                       // CultureInfo\r
-                       AssertEquals ("#C02", 3081, Test1.CultureInfo.LCID);            \r
-                       \r
-                       // IsNull\r
-                       Assert ("#C03", !Test1.IsNull);\r
-                       Assert ("#C04", SqlString.Null.IsNull);\r
-                       \r
-                       // LCID\r
-                       AssertEquals ("#C05", 3081, Test1.LCID);\r
-                       \r
-                       // SqlCompareOptions\r
-                       AssertEquals ("#C06", "IgnoreCase, IgnoreKanaType, IgnoreWidth", \r
-                                     Test1.SqlCompareOptions.ToString ());\r
-\r
-                       // Value\r
-                       AssertEquals ("#C07", "First TestString", Test1.Value);\r
-                }\r
-\r
-                // PUBLIC METHODS\r
-\r
-                public void TestCompareTo()\r
-                {\r
-                        SqlByte Test = new SqlByte (1);\r
-\r
-                        Assert ("#D01", Test1.CompareTo (Test3) < 0);\r
-                        Assert ("#D02", Test2.CompareTo (Test1) > 0);\r
-                        Assert ("#D03", Test2.CompareTo (Test3) == 0);\r
-                        Assert ("#D04", Test3.CompareTo (SqlString.Null) > 0);\r
-\r
-                        try {\r
-                                Test1.CompareTo (Test);\r
-                                Fail("#D05");\r
-                        } catch(Exception e) {\r
-                                AssertEquals ("#D06", typeof (ArgumentException), e.GetType ());\r
-                        }\r
-                }\r
-\r
-                public void TestEqualsMethods()\r
-                {\r
-                        Assert ("#E01", !Test1.Equals (Test2));\r
-                        Assert ("#E02", !Test3.Equals (Test1));\r
-                        Assert ("#E03", !Test2.Equals (new SqlString ("TEST")));\r
-                        Assert ("#E04", Test2.Equals (Test3));\r
-\r
-                        // Static Equals()-method\r
-                        Assert ("#E05", SqlString.Equals (Test2, Test3).Value);\r
-                        Assert ("#E06", !SqlString.Equals (Test1, Test2).Value);\r
-                }\r
-\r
-                public void TestGetHashCode()\r
-                {\r
-                        // FIXME: Better way to test HashCode\r
-                        AssertEquals ("#F01", Test1.GetHashCode (), \r
-                                     Test1.GetHashCode ());\r
-                       Assert ("#F02", Test1.GetHashCode () != Test2.GetHashCode ());\r
-                       Assert ("#F03", Test2.GetHashCode () == Test2.GetHashCode ());\r
-                }\r
-\r
-                public void TestGetType()\r
-                {\r
-                        AssertEquals ("#G01", "System.Data.SqlTypes.SqlString", \r
-                                     Test1.GetType ().ToString ());\r
-                        AssertEquals ("#G02", "System.String", \r
-                                     Test1.Value.GetType ().ToString ());\r
-                }\r
-\r
-               public void TestGreaters()\r
-               {\r
-\r
-                        // GreateThan ()\r
-                        Assert ("#H01", !SqlString.GreaterThan (Test1, Test2).Value);\r
-                        Assert ("#H02", SqlString.GreaterThan (Test2, Test1).Value);\r
-                        Assert ("#H03", !SqlString.GreaterThan (Test2, Test3).Value);\r
-\r
-                        // GreaterTharOrEqual ()\r
-                        Assert ("#H04", !SqlString.GreaterThanOrEqual (Test1, Test2).Value);\r
-                        Assert ("#H05", SqlString.GreaterThanOrEqual (Test2, Test1).Value);\r
-                        Assert ("#H06", SqlString.GreaterThanOrEqual (Test2, Test3).Value);\r
-                }\r
-\r
-                public void TestLessers()\r
-                {\r
-                        // LessThan()\r
-                        Assert ("#I01", !SqlString.LessThan (Test2, Test3).Value);\r
-                        Assert ("#I02", !SqlString.LessThan (Test2, Test1).Value);\r
-                        Assert ("#I03", SqlString.LessThan (Test1, Test2).Value);\r
-\r
-                        // LessThanOrEqual ()\r
-                        Assert ("#I04", SqlString.LessThanOrEqual (Test1, Test2).Value);\r
-                        Assert ("#I05", !SqlString.LessThanOrEqual (Test2, Test1).Value);\r
-                        Assert ("#I06", SqlString.LessThanOrEqual (Test3, Test2).Value);\r
-                        Assert ("#I07", SqlString.LessThanOrEqual (Test2, SqlString.Null).IsNull);\r
-                }\r
-\r
-                public void TestNotEquals()\r
-                {\r
-                        Assert ("#J01", SqlString.NotEquals (Test1, Test2).Value);\r
-                        Assert ("#J02", SqlString.NotEquals (Test2, Test1).Value);\r
-                        Assert ("#J03", SqlString.NotEquals (Test3, Test1).Value);\r
-                        Assert ("#J04", !SqlString.NotEquals (Test2, Test3).Value);\r
-\r
-                        Assert ("#J05", SqlString.NotEquals (SqlString.Null, Test3).IsNull);\r
-                }\r
-\r
-               public void TestConcat()\r
-               {\r
-                       Test1 = new SqlString ("First TestString");\r
-                       Test2 = new SqlString ("This is just a test SqlString");\r
-                       Test3 = new SqlString ("This is just a test SqlString");\r
-\r
-                       AssertEquals ("#K01", \r
-                             (SqlString)"First TestStringThis is just a test SqlString", \r
-                             SqlString.Concat (Test1, Test2));\r
-\r
-                       AssertEquals ("#K02", SqlString.Null, \r
-                                     SqlString.Concat (Test1, SqlString.Null));\r
-               }\r
-\r
-               public void TestClone()\r
-               {\r
-                       SqlString TestSqlString  = Test1.Clone ();\r
-                       AssertEquals ("#L01", Test1, TestSqlString);\r
-               }\r
-\r
-               public void TestCompareOptionsFromSqlCompareOptions()\r
-               {\r
-                       AssertEquals ("#M01", CompareOptions.IgnoreCase,\r
-                                   SqlString.CompareOptionsFromSqlCompareOptions (\r
-                                   SqlCompareOptions.IgnoreCase));\r
-                       AssertEquals ("#M02", CompareOptions.IgnoreCase,\r
-                                   SqlString.CompareOptionsFromSqlCompareOptions (\r
-                                   SqlCompareOptions.IgnoreCase));\r
-                       try {\r
-                               \r
-                               CompareOptions test = SqlString.CompareOptionsFromSqlCompareOptions (\r
-                                   SqlCompareOptions.BinarySort);\r
-                               Fail ("#M03");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#M04", typeof (ArgumentOutOfRangeException), e.GetType ());\r
-                       }\r
-               }\r
-\r
-               public void TestUnicodeBytes()\r
-               {\r
-                       AssertEquals ("#N01", (byte)105, Test1.GetNonUnicodeBytes () [1]);\r
-                       AssertEquals ("#N02", (byte)32, Test1.GetNonUnicodeBytes () [5]);\r
-\r
-                       AssertEquals ("#N03", (byte)70, Test1.GetUnicodeBytes () [0]);\r
-                       AssertEquals ("#N03b", (byte)70, Test1.GetNonUnicodeBytes () [0]);\r
-                       AssertEquals ("#N03c", (byte)0, Test1.GetUnicodeBytes () [1]);\r
-                       AssertEquals ("#N03d", (byte)105, Test1.GetNonUnicodeBytes () [1]);\r
-                       AssertEquals ("#N03e", (byte)105, Test1.GetUnicodeBytes () [2]);\r
-                       AssertEquals ("#N03f", (byte)114, Test1.GetNonUnicodeBytes () [2]);\r
-                       AssertEquals ("#N03g", (byte)0, Test1.GetUnicodeBytes () [3]);\r
-                       AssertEquals ("#N03h", (byte)115, Test1.GetNonUnicodeBytes () [3]);\r
-                       AssertEquals ("#N03i", (byte)114, Test1.GetUnicodeBytes () [4]);\r
-                       AssertEquals ("#N03j", (byte)116, Test1.GetNonUnicodeBytes () [4]);\r
-\r
-                       AssertEquals ("#N04", (byte)105, Test1.GetUnicodeBytes () [2]);\r
-\r
-                       try {\r
-                               byte test = Test1.GetUnicodeBytes () [105];\r
-                               Fail ("#N05");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#N06", typeof (IndexOutOfRangeException), e.GetType());                          \r
-                       }\r
-               }\r
-                               \r
-                public void TestConversions()\r
-                {\r
-\r
-                       SqlString String250 = new SqlString ("250");\r
-                       SqlString String9E300 = new SqlString ("9E+300");\r
-\r
-                        // ToSqlBoolean ()\r
-        \r
-                       try {\r
-                               bool test = Test1.ToSqlBoolean ().Value;                        \r
-                               Fail ("#01");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#01.5", typeof (FormatException), e.GetType());                                                          \r
-                       }\r
-                       \r
-                       Assert ("#O02", (new SqlString("1")).ToSqlBoolean ().Value);\r
-                        Assert ("#O03", !(new SqlString("0")).ToSqlBoolean ().Value);\r
-                        Assert ("#O04", (new SqlString("True")).ToSqlBoolean ().Value);\r
-                        Assert ("#O05", !(new SqlString("FALSE")).ToSqlBoolean ().Value);\r
-                        Assert ("#O06", SqlString.Null.ToSqlBoolean ().IsNull);\r
-\r
-                        // ToSqlByte ()\r
-                        try {\r
-                               byte test = Test1.ToSqlByte ().Value;\r
-                               Fail ("#07");\r
-                        } catch (Exception e) {\r
-                               AssertEquals ("#O07.5", typeof (FormatException), e.GetType());    \r
-                        }\r
-\r
-                       AssertEquals ("#O08", (byte)250, String250.ToSqlByte ().Value);    \r
-                        try {\r
-                                SqlByte b = (byte)(new SqlString ("2500")).ToSqlByte ();\r
-                                Fail ("#O09");\r
-                        } catch (Exception e) {\r
-                                AssertEquals ("#O10", typeof (OverflowException), e.GetType ());\r
-                        }\r
-\r
-                       // ToSqlDateTime\r
-                       AssertEquals ("#O11", 10, \r
-                                     (new SqlString ("2002-10-10")).ToSqlDateTime ().Value.Day);\r
-                       \r
-                        // ToSqlDecimal ()\r
-                       try {\r
-                               AssertEquals ("#O13", (decimal)250, Test1.ToSqlDecimal ().Value);\r
-                               Fail ("#O14");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#O15", typeof (FormatException), e.GetType ());\r
-                       }\r
-\r
-                        AssertEquals ("#O16", (decimal)250, String250.ToSqlDecimal ().Value);\r
-\r
-                        try {\r
-                                SqlDecimal test = String9E300.ToSqlDecimal ().Value;\r
-                                Fail ("#O17");\r
-                        } catch (Exception e) {\r
-                                AssertEquals ("#O18", typeof (FormatException), e.GetType ());\r
-                        }      \r
-\r
-                       // ToSqlDouble\r
-                       AssertEquals ("#O19", (SqlDouble)9E+300, String9E300.ToSqlDouble ());\r
-\r
-                       try {\r
-                               SqlDouble test = (new SqlString ("4e400")).ToSqlDouble ();\r
-                               Fail ("#O20");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#O21", typeof (OverflowException), e.GetType ());\r
-                       }\r
-\r
-                       // ToSqlGuid\r
-                       SqlString TestGuid = new SqlString("11111111-1111-1111-1111-111111111111");\r
-                       AssertEquals ("#O22", new SqlGuid("11111111-1111-1111-1111-111111111111"), TestGuid.ToSqlGuid ());\r
-\r
-                       try {\r
-                               SqlGuid test = String9E300.ToSqlGuid ();\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#O23", typeof (FormatException), e.GetType ());\r
-                       }\r
-                       \r
-                        // ToSqlInt16 ()\r
-                        AssertEquals ("#O24", (short)250, String250.ToSqlInt16 ().Value);\r
-\r
-                        try {\r
-                                SqlInt16 test = String9E300.ToSqlInt16().Value;\r
-                                Fail ("#O25");\r
-                        } catch (Exception e) {\r
-                                AssertEquals ("#O26", typeof (FormatException), e.GetType ());\r
-                        }        \r
-\r
-                        // ToSqlInt32 ()\r
-                        AssertEquals ("#O27", (int)250, String250.ToSqlInt32 ().Value);\r
-\r
-                        try {\r
-                                SqlInt32 test = String9E300.ToSqlInt32 ().Value;\r
-                                Fail ("#O28");\r
-                        } catch (Exception e) { \r
-                                AssertEquals ("#O29", typeof (FormatException), e.GetType ());\r
-                        }\r
-\r
-                        try {\r
-                                SqlInt32 test = Test1.ToSqlInt32 ().Value;\r
-                                Fail ("#O30");\r
-                        } catch (Exception e) { \r
-                                AssertEquals ("#O31", typeof (FormatException), e.GetType ());\r
-                        }\r
-\r
-                        // ToSqlInt64 ()\r
-                        AssertEquals ("#O32", (long)250, String250.ToSqlInt64 ().Value);\r
-\r
-                        try {        \r
-                                SqlInt64 test = String9E300.ToSqlInt64 ().Value;\r
-                                Fail ("#O33");\r
-                        } catch (Exception e) {\r
-                                AssertEquals ("#O34", typeof (FormatException), e.GetType ());\r
-                        }        \r
-\r
-                        // ToSqlMoney ()\r
-                        AssertEquals ("#O35", (decimal)250, String250.ToSqlMoney ().Value);\r
-\r
-                        try {\r
-                                SqlMoney test = String9E300.ToSqlMoney ().Value;\r
-                                Fail ("#O36");\r
-                        } catch (Exception e) {\r
-                                AssertEquals ("#O37", typeof (FormatException), e.GetType ());\r
-                        }        \r
-\r
-                        // ToSqlSingle ()\r
-                        AssertEquals ("#O38", (float)250, String250.ToSqlSingle ().Value);\r
-\r
-                        try {\r
-                                SqlSingle test = String9E300.ToSqlSingle().Value;\r
-                                Fail ("#O39");\r
-                        } catch (Exception e) {\r
-                                AssertEquals ("#O40", typeof (OverflowException), e.GetType ());\r
-                        }        \r
-\r
-                        // ToString ()\r
-                        AssertEquals ("#O41", "First TestString", Test1.ToString ());\r
-                }\r
-\r
-                // OPERATORS\r
-\r
-                public void TestArithmeticOperators()\r
-                {\r
-                       SqlString TestString = new SqlString ("...Testing...");\r
-                       AssertEquals ("#P01", (SqlString)"First TestString...Testing...",\r
-                                     Test1 + TestString);\r
-                       AssertEquals ("#P02", SqlString.Null,\r
-                                     Test1 + SqlString.Null);\r
-                }\r
-\r
-                public void TestThanOrEqualOperators()\r
-                {\r
-                        // == -operator\r
-                        Assert ("#Q01", (Test2 == Test3).Value);\r
-                        Assert ("#Q02", !(Test1 == Test2).Value);\r
-                        Assert ("#Q03", (Test1 == SqlString.Null).IsNull);\r
-                        \r
-                        // != -operator\r
-                        Assert ("#Q04", !(Test3 != Test2).Value);\r
-                        Assert ("#Q05", !(Test2 != Test3).Value);\r
-                        Assert ("#Q06", (Test1 != Test3).Value);\r
-                        Assert ("#Q07", (Test1 != SqlString.Null).IsNull);\r
-\r
-                        // > -operator\r
-                        Assert ("#Q08", (Test2 > Test1).Value);\r
-                        Assert ("#Q09", !(Test1 > Test3).Value);\r
-                        Assert ("#Q10", !(Test2 > Test3).Value);\r
-                        Assert ("#Q11", (Test1 > SqlString.Null).IsNull);\r
-\r
-                        // >=  -operator\r
-                        Assert ("#Q12", !(Test1 >= Test3).Value);\r
-                        Assert ("#Q13", (Test3 >= Test1).Value);\r
-                        Assert ("#Q14", (Test2 >= Test3).Value);\r
-                        Assert ("#Q15", (Test1 >= SqlString.Null).IsNull);\r
-\r
-                        // < -operator\r
-                        Assert ("#Q16", (Test1 < Test2).Value);\r
-                        Assert ("#Q17", (Test1 < Test3).Value);\r
-                        Assert ("#Q18", !(Test2 < Test3).Value);\r
-                        Assert ("#Q19", (Test1 < SqlString.Null).IsNull);\r
-\r
-                        // <= -operator\r
-                        Assert ("#Q20", (Test1 <= Test3).Value);\r
-                        Assert ("#Q21", !(Test3 <= Test1).Value);\r
-                        Assert ("#Q22", (Test2 <= Test3).Value);\r
-                        Assert ("#Q23", (Test1 <= SqlString.Null).IsNull);\r
-                }\r
-\r
-                public void TestSqlBooleanToSqlString()\r
-                {\r
-                        SqlBoolean TestBoolean = new SqlBoolean (true);\r
-                        SqlBoolean TestBoolean2 = new SqlBoolean (false);\r
-                        SqlString Result;\r
-\r
-                        Result = (SqlString)TestBoolean;\r
-                        AssertEquals ("#R01", "True", Result.Value);\r
-                       \r
-                       Result = (SqlString)TestBoolean2;\r
-                        AssertEquals ("#R02", "False", Result.Value);\r
-                       \r
-                        Result = (SqlString)SqlBoolean.Null;\r
-                        Assert ("#R03", Result.IsNull);\r
-                }\r
-\r
-               public void TestSqlByteToBoolean()\r
-               {\r
-                       SqlByte TestByte = new SqlByte (250);\r
-                       AssertEquals ("#S01", "250", ((SqlString)TestByte).Value);\r
-                       try {\r
-                               SqlString test = ((SqlString)SqlByte.Null).Value;\r
-                               Fail ("#S02");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#S03", typeof (SqlNullValueException), e.GetType ());\r
-                       }\r
-               }\r
-\r
-               public void TestSqlDateTimeToSqlString()\r
-               {                       \r
-                       Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-AU");\r
-                       SqlDateTime TestTime = new SqlDateTime(2002, 10, 22, 9, 52, 30);\r
-                       AssertEquals ("#T01", "22/10/2002 9:52:30 AM", ((SqlString)TestTime).Value);                    \r
-               }\r
-               \r
-               public void TestSqlDecimalToSqlString()\r
-               {\r
-                       SqlDecimal TestDecimal = new SqlDecimal (1000.2345);\r
-                       AssertEquals ("#U01", "1000.2345000000000", ((SqlString)TestDecimal).Value);\r
-               }\r
-               \r
-                public void TestSqlDoubleToSqlString()\r
-                {\r
-                       SqlDouble TestDouble = new SqlDouble (64E+64);\r
-                       AssertEquals ("#V01", "6.4E+65", ((SqlString)TestDouble).Value);\r
-                }\r
-\r
-               public void TestSqlGuidToSqlString()\r
-               {\r
-                       byte [] b = new byte [16];\r
-                       b [0] = 100;\r
-                       b [1] = 64;\r
-                       SqlGuid TestGuid = new SqlGuid (b);\r
-                       \r
-                       AssertEquals ("#W01", "00004064-0000-0000-0000-000000000000", \r
-                                     ((SqlString)TestGuid).Value);\r
-                       try {\r
-                               SqlString test = ((SqlString)SqlGuid.Null).Value;\r
-                               Fail ("#W02");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#W03", typeof (SqlNullValueException), e.GetType());\r
-                       }\r
-               }\r
-               \r
-               public void TestSqlInt16ToSqlString()\r
-               {\r
-                       SqlInt16 TestInt = new SqlInt16(20012);\r
-                       AssertEquals ("#X01", "20012", ((SqlString)TestInt).Value);\r
-                       try {\r
-                               SqlString test = ((SqlString)SqlInt16.Null).Value;\r
-                               Fail ("#X02");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#X03", typeof (SqlNullValueException), e.GetType ());                            \r
-                       }\r
-               }\r
-                \r
-                public void TestSqlInt32ToSqlString()\r
-                {\r
-                       SqlInt32 TestInt = new SqlInt32(-12456);\r
-                       AssertEquals ("#Y01", "-12456", ((SqlString)TestInt).Value);\r
-                       try {\r
-                               SqlString test = ((SqlString)SqlInt32.Null).Value;\r
-                               Fail ("#Y02");\r
-                       } catch (Exception e) {\r
-                               AssertEquals ("#Y03", typeof (SqlNullValueException), e.GetType ());                            \r
-                       }\r
-                }\r
-                \r
-                public void TestSqlInt64ToSqlString()\r
-                {\r
-                       SqlInt64 TestInt = new SqlInt64(10101010);\r
-                       AssertEquals ("#Z01", "10101010", ((SqlString)TestInt).Value);\r
-                }\r
-                \r
-                public void TestSqlMoneyToSqlString()\r
-                {\r
-                       SqlMoney TestMoney = new SqlMoney (646464.6464);\r
-                       AssertEquals ("#AA01", "646464.6464", ((SqlString)TestMoney).Value);\r
-                }\r
-                \r
-                public void TestSqlSingleToSqlString()\r
-                {\r
-                       SqlSingle TestSingle = new SqlSingle (3E+20);\r
-                       AssertEquals ("#AB01", "3E+20", ((SqlString)TestSingle).Value);\r
-                }\r
-                                              \r
-                public void TestSqlStringToString()\r
-                {\r
-                       AssertEquals ("#AC01", "First TestString",(String)Test1);                       \r
-                }\r
-\r
-               public void TestStringToSqlString()\r
-               {\r
-                       String TestString = "Test String";\r
-                       AssertEquals ("#AD01", "Test String", ((SqlString)TestString).Value);                   \r
-               }               \r
-        }\r
-}\r
-\r
-\r
-\r
+// SqlStringTest.cs - NUnit Test Cases for System.Data.SqlTypes.SqlString
+//
+// Ville Palo (vi64pa@koti.soon.fi)
+//
+// (C) Ville Palo 2002
+// 
+
+using NUnit.Framework;
+using System;
+using System.Data.SqlTypes;
+using System.Globalization;
+using System.Threading;
+
+namespace MonoTests.System.Data.SqlTypes
+{
+        public class SqlStringTest : TestCase {
+
+                private SqlString Test1 = null;
+                private SqlString Test2 = null;
+                private SqlString Test3 = null;
+
+                public SqlStringTest() : base ("System.Data.SqlTypes.SqlString") {}
+                public SqlStringTest(string name) : base(name) {}
+
+                protected override void TearDown() {}
+
+                protected override void SetUp()
+                {
+                        Test1 = new SqlString ("First TestString");
+                        Test2 = new SqlString ("This is just a test SqlString");
+                        Test3 = new SqlString ("This is just a test SqlString");
+                        Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-AU");
+                }
+
+                public static ITest Suite {
+                        get {
+
+                                return new TestSuite(typeof(SqlDateTime));
+
+                        }
+
+                }
+
+                // Test constructor
+                public void TestCreate()
+                {
+
+                        // SqlString (String)
+                        SqlString  TestString = new SqlString ("Test");
+                        AssertEquals ("#A01", "Test", TestString.Value);
+
+                        // SqlString (String, int)\r\r
+                        TestString = new SqlString ("Test", 2057);\r\r
+                        AssertEquals ("#A02", 2057, TestString.LCID);\r\r
+\r\r
+                        // SqlString (int, SqlCompareOptions, byte[])\r\r
+                        TestString = new SqlString (2057,\r\r
+                                                    SqlCompareOptions.BinarySort|SqlCompareOptions.IgnoreCase,\r\r
+                                                    new byte [2] {123, 221});\r\r
+                        AssertEquals ("#A03", 2057, TestString.CompareInfo.LCID);\r\r
+                        \r\r
+                        // SqlString(string, int, SqlCompareOptions)\r\r
+                        TestString = new SqlString ("Test", 2057, SqlCompareOptions.IgnoreNonSpace);\r\r
+                        Assert ("#A04", !TestString.IsNull);\r\r
+                        \r\r
+                        // SqlString (int, SqlCompareOptions, byte[], bool)\r\r
+                        TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [4] {100, 100, 200, 45}, true);\r\r
+                        AssertEquals ("#A05", (byte)63, TestString.GetNonUnicodeBytes () [0]);\r\r
+                        TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, false);\r\r
+                        AssertEquals ("#A06", (String)"qd", TestString.Value);\r\r
+                        \r\r
+                        // SqlString (int, SqlCompareOptions, byte[], int, int)\r\r
+                        TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, 0, 2);\r\r
+                        Assert ("#A07", !TestString.IsNull);\r\r
+\r\r
+                        try {\r\r
+                                TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, 2, 1);\r\r
+                                Fail ("#A07b");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#A07c", typeof (ArgumentOutOfRangeException), e.GetType ());\r\r
+                        }\r\r
+\r\r
+                        try {\r\r
+                                TestString = new SqlString (2057, SqlCompareOptions.BinarySort, new byte [2] {113, 100}, 0, 4);\r\r
+                                Fail ("#A07d");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#A07e", typeof (ArgumentOutOfRangeException), e.GetType ());\r\r
+                        }\r\r
+\r\r
+                        // SqlString (int, SqlCompareOptions, byte[], int, int, bool)\r\r
+                        TestString = new SqlString (2057, SqlCompareOptions.IgnoreCase, new byte [3] {100, 111, 50}, 1, 2, false);\r\r
+                        AssertEquals ("#A08", "o2", TestString.Value);\r\r
+                        TestString = new SqlString (2057, SqlCompareOptions.IgnoreCase, new byte [3] {123, 111, 222}, 1, 2, true);\r\r
+                        Assert ("#A09", !TestString.IsNull);                        \r\r
+                }\r\r
+\r\r
+                // Test public fields\r\r
+                public void TestPublicFields()\r\r
+                {\r\r
+                        // BinarySort\r\r
+                        AssertEquals ("#B01", 32768, SqlString.BinarySort);\r\r
+                        \r\r
+                        // IgnoreCase\r\r
+                        AssertEquals ("#B02", 1, SqlString.IgnoreCase);\r\r
+                                      \r\r
+                        // IgnoreKanaType\r\r
+                        AssertEquals ("#B03", 8, SqlString.IgnoreKanaType);\r\r
+\r\r
+                        // IgnoreNonSpace\r\r
+                        AssertEquals ("#B04", 2, SqlString.IgnoreNonSpace);\r\r
+                        \r\r
+                        // IgnoreWidth\r\r
+                        AssertEquals ("#B05", 16, SqlString.IgnoreWidth);\r\r
+                        \r\r
+                        // Null\r\r
+                        Assert ("#B06", SqlString.Null.IsNull);\r\r
+                }\r\r
+\r\r
+                // Test properties\r\r
+                public void TestProperties()\r\r
+                {\r\r
+                        // CompareInfo\r\r
+                        AssertEquals ("#C01", 3081, Test1.CompareInfo.LCID);\r\r
+\r\r
+                        // CultureInfo\r\r
+                        AssertEquals ("#C02", 3081, Test1.CultureInfo.LCID);                \r\r
+                        \r\r
+                        // IsNull\r\r
+                        Assert ("#C03", !Test1.IsNull);\r\r
+                        Assert ("#C04", SqlString.Null.IsNull);\r\r
+                        \r\r
+                        // LCID\r\r
+                        AssertEquals ("#C05", 3081, Test1.LCID);\r\r
+                        \r\r
+                        // SqlCompareOptions\r\r
+                        AssertEquals ("#C06", "IgnoreCase, IgnoreKanaType, IgnoreWidth", \r\r
+                                      Test1.SqlCompareOptions.ToString ());\r\r
+\r\r
+                        // Value\r\r
+                        AssertEquals ("#C07", "First TestString", Test1.Value);\r\r
+                }\r\r
+\r\r
+                // PUBLIC METHODS\r\r
+\r\r
+                public void TestCompareTo()\r\r
+                {\r\r
+                        SqlByte Test = new SqlByte (1);\r\r
+\r\r
+                        Assert ("#D01", Test1.CompareTo (Test3) < 0);\r\r
+                        Assert ("#D02", Test2.CompareTo (Test1) > 0);\r\r
+                        Assert ("#D03", Test2.CompareTo (Test3) == 0);\r\r
+                        Assert ("#D04", Test3.CompareTo (SqlString.Null) > 0);\r\r
+\r\r
+                        try {\r\r
+                                Test1.CompareTo (Test);\r\r
+                                Fail("#D05");\r\r
+                        } catch(Exception e) {                        \r\r
+                                AssertEquals ("#D06", typeof (ArgumentException), e.GetType ());\r\r
+                        }\r\r
+                        \r\r
+                        SqlString T1 = new SqlString ("test", 2057, SqlCompareOptions.IgnoreCase);\r\r
+                       SqlString T2 = new SqlString ("TEST", 2057, SqlCompareOptions.None);\r\r
+                       \r\r
+                       try {\r\r
+                               T1.CompareTo (T2);\r\r
+                               Fail ("#D07");\r\r
+                       } catch (Exception e) {\r\r
+                               AssertEquals ("#D08", typeof (SqlTypeException), e.GetType ());\r\r
+                       }\r\r
+                       \r\r
+                       // IgnoreCase\r\r
+                       T1 = new SqlString ("test", 2057, SqlCompareOptions.IgnoreCase);\r\r
+                       T2 = new SqlString ("TEST", 2057, SqlCompareOptions.IgnoreCase);\r\r
+                       Assert ("#D09", T2.CompareTo (T1) == 0);\r\r
+                \r\r
+                       T1 = new SqlString ("test", 2057);\r\r
+                       T2 = new SqlString ("TEST", 2057);\r\r
+                       Assert ("#D10", T2.CompareTo (T1) == 0);\r\r
+\r\r
+                       T1 = new SqlString ("test", 2057, SqlCompareOptions.None);\r\r
+                       T2 = new SqlString ("TEST", 2057, SqlCompareOptions.None);\r\r
+                       Assert ("#D11", T2.CompareTo (T1) != 0);\r\r
+\r\r
+                       // IgnoreNonSpace\r\r
+                        T1 = new SqlString ("TESTñ", 2057, SqlCompareOptions.IgnoreNonSpace);\r\r
+                       T2 = new SqlString ("TESTn", 2057, SqlCompareOptions.IgnoreNonSpace);\r\r
+                       Assert ("#D12", T2.CompareTo (T1) == 0);\r\r
+                \r\r
+                       T1 = new SqlString ("TESTñ", 2057, SqlCompareOptions.None);\r\r
+                       T2 = new SqlString ("TESTn", 2057, SqlCompareOptions.None);\r\r
+                       Assert ("#D13", T2.CompareTo (T1) != 0);\r\r
+\r\r
+                       // BinarySort\r\r
+                       T1 = new SqlString ("01_", 2057, SqlCompareOptions.BinarySort);\r\r
+                       T2 = new SqlString ("_01", 2057, SqlCompareOptions.BinarySort);\r\r
+                       Assert ("#D14", T1.CompareTo (T2) < 0);\r\r
+                       \r\r
+                       T1 = new SqlString ("01_", 2057, SqlCompareOptions.None);\r\r
+                       T2 = new SqlString ("_01", 2057, SqlCompareOptions.None);\r\r
+                       Assert ("#D15", T1.CompareTo (T2) > 0);                 \r\r
+                }\r\r
+\r\r
+                public void TestEqualsMethods()\r\r
+                {\r\r
+                        Assert ("#E01", !Test1.Equals (Test2));\r\r
+                        Assert ("#E02", !Test3.Equals (Test1));\r\r
+                        Assert ("#E03", !Test2.Equals (new SqlString ("TEST")));\r\r
+                        Assert ("#E04", Test2.Equals (Test3));\r\r
+\r\r
+                        // Static Equals()-method\r\r
+                        Assert ("#E05", SqlString.Equals (Test2, Test3).Value);\r\r
+                        Assert ("#E06", !SqlString.Equals (Test1, Test2).Value);\r\r
+                }\r\r
+\r\r
+                public void TestGetHashCode()\r\r
+                {\r\r
+                        // FIXME: Better way to test HashCode\r\r
+                        AssertEquals ("#F01", Test1.GetHashCode (), \r\r
+                                      Test1.GetHashCode ());\r\r
+                        Assert ("#F02", Test1.GetHashCode () != Test2.GetHashCode ());\r\r
+                        Assert ("#F03", Test2.GetHashCode () == Test2.GetHashCode ());\r\r
+                }\r\r
+\r\r
+                public void TestGetType()\r\r
+                {\r\r
+                        AssertEquals ("#G01", "System.Data.SqlTypes.SqlString", \r\r
+                                      Test1.GetType ().ToString ());\r\r
+                        AssertEquals ("#G02", "System.String", \r\r
+                                      Test1.Value.GetType ().ToString ());\r\r
+                }\r\r
+\r\r
+                public void TestGreaters()\r\r
+                {\r\r
+\r\r
+                        // GreateThan ()\r\r
+                        Assert ("#H01", !SqlString.GreaterThan (Test1, Test2).Value);\r\r
+                        Assert ("#H02", SqlString.GreaterThan (Test2, Test1).Value);\r\r
+                        Assert ("#H03", !SqlString.GreaterThan (Test2, Test3).Value);\r\r
+\r\r
+                        // GreaterTharOrEqual ()\r\r
+                        Assert ("#H04", !SqlString.GreaterThanOrEqual (Test1, Test2).Value);\r\r
+                        Assert ("#H05", SqlString.GreaterThanOrEqual (Test2, Test1).Value);\r\r
+                        Assert ("#H06", SqlString.GreaterThanOrEqual (Test2, Test3).Value);\r\r
+                }\r\r
+\r\r
+                public void TestLessers()\r\r
+                {\r\r
+                        // LessThan()\r\r
+                        Assert ("#I01", !SqlString.LessThan (Test2, Test3).Value);\r\r
+                        Assert ("#I02", !SqlString.LessThan (Test2, Test1).Value);\r\r
+                        Assert ("#I03", SqlString.LessThan (Test1, Test2).Value);\r\r
+\r\r
+                        // LessThanOrEqual ()\r\r
+                        Assert ("#I04", SqlString.LessThanOrEqual (Test1, Test2).Value);\r\r
+                        Assert ("#I05", !SqlString.LessThanOrEqual (Test2, Test1).Value);\r\r
+                        Assert ("#I06", SqlString.LessThanOrEqual (Test3, Test2).Value);\r\r
+                        Assert ("#I07", SqlString.LessThanOrEqual (Test2, SqlString.Null).IsNull);\r\r
+                }\r\r
+\r\r
+                public void TestNotEquals()\r\r
+                {\r\r
+                        Assert ("#J01", SqlString.NotEquals (Test1, Test2).Value);\r\r
+                        Assert ("#J02", SqlString.NotEquals (Test2, Test1).Value);\r\r
+                        Assert ("#J03", SqlString.NotEquals (Test3, Test1).Value);\r\r
+                        Assert ("#J04", !SqlString.NotEquals (Test2, Test3).Value);\r\r
+\r\r
+                        Assert ("#J05", SqlString.NotEquals (SqlString.Null, Test3).IsNull);\r\r
+                }\r\r
+\r\r
+                public void TestConcat()\r\r
+                {\r\r
+                        Test1 = new SqlString ("First TestString");\r\r
+                        Test2 = new SqlString ("This is just a test SqlString");\r\r
+                        Test3 = new SqlString ("This is just a test SqlString");\r\r
+\r\r
+                        AssertEquals ("#K01", \r\r
+                              (SqlString)"First TestStringThis is just a test SqlString", \r\r
+                              SqlString.Concat (Test1, Test2));\r\r
+\r\r
+                        AssertEquals ("#K02", SqlString.Null, \r\r
+                                      SqlString.Concat (Test1, SqlString.Null));\r\r
+                }\r\r
+\r\r
+                public void TestClone()\r\r
+                {\r\r
+                        SqlString TestSqlString  = Test1.Clone ();\r\r
+                        AssertEquals ("#L01", Test1, TestSqlString);\r\r
+                }\r\r
+\r\r
+                public void TestCompareOptionsFromSqlCompareOptions()\r\r
+                {\r\r
+                        AssertEquals ("#M01", CompareOptions.IgnoreCase,\r\r
+                                    SqlString.CompareOptionsFromSqlCompareOptions (\r\r
+                                    SqlCompareOptions.IgnoreCase));\r\r
+                        AssertEquals ("#M02", CompareOptions.IgnoreCase,\r\r
+                                    SqlString.CompareOptionsFromSqlCompareOptions (\r\r
+                                    SqlCompareOptions.IgnoreCase));\r\r
+                        try {\r\r
+                                \r\r
+                                CompareOptions test = SqlString.CompareOptionsFromSqlCompareOptions (\r\r
+                                    SqlCompareOptions.BinarySort);\r\r
+                                Fail ("#M03");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#M04", typeof (ArgumentOutOfRangeException), e.GetType ());\r\r
+                        }\r\r
+                }\r\r
+\r\r
+                public void TestUnicodeBytes()\r\r
+                {\r\r
+                        AssertEquals ("#N01", (byte)105, Test1.GetNonUnicodeBytes () [1]);\r\r
+                        AssertEquals ("#N02", (byte)32, Test1.GetNonUnicodeBytes () [5]);\r\r
+\r\r
+                        AssertEquals ("#N03", (byte)70, Test1.GetUnicodeBytes () [0]);\r\r
+                        AssertEquals ("#N03b", (byte)70, Test1.GetNonUnicodeBytes () [0]);\r\r
+                        AssertEquals ("#N03c", (byte)0, Test1.GetUnicodeBytes () [1]);\r\r
+                        AssertEquals ("#N03d", (byte)105, Test1.GetNonUnicodeBytes () [1]);\r\r
+                        AssertEquals ("#N03e", (byte)105, Test1.GetUnicodeBytes () [2]);\r\r
+                        AssertEquals ("#N03f", (byte)114, Test1.GetNonUnicodeBytes () [2]);\r\r
+                        AssertEquals ("#N03g", (byte)0, Test1.GetUnicodeBytes () [3]);\r\r
+                        AssertEquals ("#N03h", (byte)115, Test1.GetNonUnicodeBytes () [3]);\r\r
+                        AssertEquals ("#N03i", (byte)114, Test1.GetUnicodeBytes () [4]);\r\r
+                        AssertEquals ("#N03j", (byte)116, Test1.GetNonUnicodeBytes () [4]);\r\r
+\r\r
+                        AssertEquals ("#N04", (byte)105, Test1.GetUnicodeBytes () [2]);\r\r
+\r\r
+                        try {\r\r
+                                byte test = Test1.GetUnicodeBytes () [105];\r\r
+                                Fail ("#N05");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#N06", typeof (IndexOutOfRangeException), e.GetType());                                \r\r
+                        }\r\r
+                }\r\r
+                                \r\r
+                public void TestConversions()\r\r
+                {\r\r
+\r\r
+                        SqlString String250 = new SqlString ("250");\r\r
+                        SqlString String9E300 = new SqlString ("9E+300");\r\r
+\r\r
+                        // ToSqlBoolean ()\r\r
+        \r\r
+                        try {\r\r
+                                bool test = Test1.ToSqlBoolean ().Value;                              \r\r
+                                Fail ("#01");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#01.5", typeof (FormatException), e.GetType());                                                                \r\r
+                        }\r\r
+                        \r\r
+                        Assert ("#O02", (new SqlString("1")).ToSqlBoolean ().Value);\r\r
+                        Assert ("#O03", !(new SqlString("0")).ToSqlBoolean ().Value);\r\r
+                        Assert ("#O04", (new SqlString("True")).ToSqlBoolean ().Value);\r\r
+                        Assert ("#O05", !(new SqlString("FALSE")).ToSqlBoolean ().Value);\r\r
+                        Assert ("#O06", SqlString.Null.ToSqlBoolean ().IsNull);\r\r
+\r\r
+                        // ToSqlByte ()\r\r
+                        try {\r\r
+                                byte test = Test1.ToSqlByte ().Value;\r\r
+                                Fail ("#07");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#O07.5", typeof (FormatException), e.GetType());    \r\r
+                        }\r\r
+\r\r
+                        AssertEquals ("#O08", (byte)250, String250.ToSqlByte ().Value);    \r\r
+                        try {\r\r
+                                SqlByte b = (byte)(new SqlString ("2500")).ToSqlByte ();\r\r
+                                Fail ("#O09");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#O10", typeof (OverflowException), e.GetType ());\r\r
+                        }\r\r
+\r\r
+                        // ToSqlDateTime\r\r
+                        AssertEquals ("#O11", 10, \r\r
+                                      (new SqlString ("2002-10-10")).ToSqlDateTime ().Value.Day);\r\r
+                        \r\r
+                        // ToSqlDecimal ()\r\r
+                        try {\r\r
+                                AssertEquals ("#O13", (decimal)250, Test1.ToSqlDecimal ().Value);\r\r
+                                Fail ("#O14");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#O15", typeof (FormatException), e.GetType ());\r\r
+                        }\r\r
+\r\r
+                        AssertEquals ("#O16", (decimal)250, String250.ToSqlDecimal ().Value);\r\r
+\r\r
+                        try {\r\r
+                                SqlDecimal test = String9E300.ToSqlDecimal ().Value;\r\r
+                                Fail ("#O17");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#O18", typeof (FormatException), e.GetType ());\r\r
+                        }      \r\r
+\r\r
+                        // ToSqlDouble\r\r
+                        AssertEquals ("#O19", (SqlDouble)9E+300, String9E300.ToSqlDouble ());\r\r
+\r\r
+                        try {\r\r
+                                SqlDouble test = (new SqlString ("4e400")).ToSqlDouble ();\r\r
+                                Fail ("#O20");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#O21", typeof (OverflowException), e.GetType ());\r\r
+                        }\r\r
+\r\r
+                        // ToSqlGuid\r\r
+                        SqlString TestGuid = new SqlString("11111111-1111-1111-1111-111111111111");\r\r
+                        AssertEquals ("#O22", new SqlGuid("11111111-1111-1111-1111-111111111111"), TestGuid.ToSqlGuid ());\r\r
+\r\r
+                        try {\r\r
+                                SqlGuid test = String9E300.ToSqlGuid ();\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#O23", typeof (FormatException), e.GetType ());\r\r
+                        }\r\r
+                        \r\r
+                        // ToSqlInt16 ()\r\r
+                        AssertEquals ("#O24", (short)250, String250.ToSqlInt16 ().Value);\r\r
+\r\r
+                        try {\r\r
+                                SqlInt16 test = String9E300.ToSqlInt16().Value;\r\r
+                                Fail ("#O25");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#O26", typeof (FormatException), e.GetType ());\r\r
+                        }        \r\r
+\r\r
+                        // ToSqlInt32 ()\r\r
+                        AssertEquals ("#O27", (int)250, String250.ToSqlInt32 ().Value);\r\r
+\r\r
+                        try {\r\r
+                                SqlInt32 test = String9E300.ToSqlInt32 ().Value;\r\r
+                                Fail ("#O28");\r\r
+                        } catch (Exception e) { \r\r
+                                AssertEquals ("#O29", typeof (FormatException), e.GetType ());\r\r
+                        }\r\r
+\r\r
+                        try {\r\r
+                                SqlInt32 test = Test1.ToSqlInt32 ().Value;\r\r
+                                Fail ("#O30");\r\r
+                        } catch (Exception e) { \r\r
+                                AssertEquals ("#O31", typeof (FormatException), e.GetType ());\r\r
+                        }\r\r
+\r\r
+                        // ToSqlInt64 ()\r\r
+                        AssertEquals ("#O32", (long)250, String250.ToSqlInt64 ().Value);\r\r
+\r\r
+                        try {        \r\r
+                                SqlInt64 test = String9E300.ToSqlInt64 ().Value;\r\r
+                                Fail ("#O33");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#O34", typeof (FormatException), e.GetType ());\r\r
+                        }        \r\r
+\r\r
+                        // ToSqlMoney ()\r\r
+                        AssertEquals ("#O35", (decimal)250, String250.ToSqlMoney ().Value);\r\r
+\r\r
+                        try {\r\r
+                                SqlMoney test = String9E300.ToSqlMoney ().Value;\r\r
+                                Fail ("#O36");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#O37", typeof (FormatException), e.GetType ());\r\r
+                        }        \r\r
+\r\r
+                        // ToSqlSingle ()\r\r
+                        AssertEquals ("#O38", (float)250, String250.ToSqlSingle ().Value);\r\r
+\r\r
+                        try {\r\r
+                                SqlSingle test = String9E300.ToSqlSingle().Value;\r\r
+                                Fail ("#O39");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#O40", typeof (OverflowException), e.GetType ());\r\r
+                        }        \r\r
+\r\r
+                        // ToString ()\r\r
+                        AssertEquals ("#O41", "First TestString", Test1.ToString ());\r\r
+                }\r\r
+\r\r
+                // OPERATORS\r\r
+\r\r
+                public void TestArithmeticOperators()\r\r
+                {\r\r
+                        SqlString TestString = new SqlString ("...Testing...");\r\r
+                        AssertEquals ("#P01", (SqlString)"First TestString...Testing...",\r\r
+                                      Test1 + TestString);\r\r
+                        AssertEquals ("#P02", SqlString.Null,\r\r
+                                      Test1 + SqlString.Null);\r\r
+                }\r\r
+\r\r
+                public void TestThanOrEqualOperators()\r\r
+                {\r\r
+                        // == -operator\r\r
+                        Assert ("#Q01", (Test2 == Test3).Value);\r\r
+                        Assert ("#Q02", !(Test1 == Test2).Value);\r\r
+                        Assert ("#Q03", (Test1 == SqlString.Null).IsNull);\r\r
+                        \r\r
+                        // != -operator\r\r
+                        Assert ("#Q04", !(Test3 != Test2).Value);\r\r
+                        Assert ("#Q05", !(Test2 != Test3).Value);\r\r
+                        Assert ("#Q06", (Test1 != Test3).Value);\r\r
+                        Assert ("#Q07", (Test1 != SqlString.Null).IsNull);\r\r
+\r\r
+                        // > -operator\r\r
+                        Assert ("#Q08", (Test2 > Test1).Value);\r\r
+                        Assert ("#Q09", !(Test1 > Test3).Value);\r\r
+                        Assert ("#Q10", !(Test2 > Test3).Value);\r\r
+                        Assert ("#Q11", (Test1 > SqlString.Null).IsNull);\r\r
+\r\r
+                        // >=  -operator\r\r
+                        Assert ("#Q12", !(Test1 >= Test3).Value);\r\r
+                        Assert ("#Q13", (Test3 >= Test1).Value);\r\r
+                        Assert ("#Q14", (Test2 >= Test3).Value);\r\r
+                        Assert ("#Q15", (Test1 >= SqlString.Null).IsNull);\r\r
+\r\r
+                        // < -operator\r\r
+                        Assert ("#Q16", (Test1 < Test2).Value);\r\r
+                        Assert ("#Q17", (Test1 < Test3).Value);\r\r
+                        Assert ("#Q18", !(Test2 < Test3).Value);\r\r
+                        Assert ("#Q19", (Test1 < SqlString.Null).IsNull);\r\r
+\r\r
+                        // <= -operator\r\r
+                        Assert ("#Q20", (Test1 <= Test3).Value);\r\r
+                        Assert ("#Q21", !(Test3 <= Test1).Value);\r\r
+                        Assert ("#Q22", (Test2 <= Test3).Value);\r\r
+                        Assert ("#Q23", (Test1 <= SqlString.Null).IsNull);\r\r
+                }\r\r
+\r\r
+                public void TestSqlBooleanToSqlString()\r\r
+                {\r\r
+                        SqlBoolean TestBoolean = new SqlBoolean (true);\r\r
+                        SqlBoolean TestBoolean2 = new SqlBoolean (false);\r\r
+                        SqlString Result;\r\r
+\r\r
+                        Result = (SqlString)TestBoolean;\r\r
+                        AssertEquals ("#R01", "True", Result.Value);\r\r
+                        \r\r
+                        Result = (SqlString)TestBoolean2;\r\r
+                        AssertEquals ("#R02", "False", Result.Value);\r\r
+                        \r\r
+                        Result = (SqlString)SqlBoolean.Null;\r\r
+                        Assert ("#R03", Result.IsNull);\r\r
+                }\r\r
+\r\r
+                public void TestSqlByteToBoolean()\r\r
+                {\r\r
+                        SqlByte TestByte = new SqlByte (250);\r\r
+                        AssertEquals ("#S01", "250", ((SqlString)TestByte).Value);\r\r
+                        try {\r\r
+                                SqlString test = ((SqlString)SqlByte.Null).Value;\r\r
+                                Fail ("#S02");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#S03", typeof (SqlNullValueException), e.GetType ());\r\r
+                        }\r\r
+                }\r\r
+\r\r
+                public void TestSqlDateTimeToSqlString()\r\r
+                {                        \r\r
+                        Thread.CurrentThread.CurrentCulture = new CultureInfo ("en-AU");\r\r
+                        SqlDateTime TestTime = new SqlDateTime(2002, 10, 22, 9, 52, 30);\r\r
+                        AssertEquals ("#T01", "22/10/2002 9:52:30 AM", ((SqlString)TestTime).Value);                        \r\r
+                }\r\r
+                \r\r
+                public void TestSqlDecimalToSqlString()\r\r
+                {\r\r
+                        SqlDecimal TestDecimal = new SqlDecimal (1000.2345);\r\r
+                        AssertEquals ("#U01", "1000.2345000000000", ((SqlString)TestDecimal).Value);\r\r
+                }\r\r
+                \r\r
+                public void TestSqlDoubleToSqlString()\r\r
+                {\r\r
+                        SqlDouble TestDouble = new SqlDouble (64E+64);\r\r
+                        AssertEquals ("#V01", "6.4E+65", ((SqlString)TestDouble).Value);\r\r
+                }\r\r
+\r\r
+                public void TestSqlGuidToSqlString()\r\r
+                {\r\r
+                        byte [] b = new byte [16];\r\r
+                        b [0] = 100;\r\r
+                        b [1] = 64;\r\r
+                        SqlGuid TestGuid = new SqlGuid (b);\r\r
+                        \r\r
+                        AssertEquals ("#W01", "00004064-0000-0000-0000-000000000000", \r\r
+                                      ((SqlString)TestGuid).Value);\r\r
+                        try {\r\r
+                                SqlString test = ((SqlString)SqlGuid.Null).Value;\r\r
+                                Fail ("#W02");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#W03", typeof (SqlNullValueException), e.GetType());\r\r
+                        }\r\r
+                }\r\r
+                \r\r
+                public void TestSqlInt16ToSqlString()\r\r
+                {\r\r
+                        SqlInt16 TestInt = new SqlInt16(20012);\r\r
+                        AssertEquals ("#X01", "20012", ((SqlString)TestInt).Value);\r\r
+                        try {\r\r
+                                SqlString test = ((SqlString)SqlInt16.Null).Value;\r\r
+                                Fail ("#X02");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#X03", typeof (SqlNullValueException), e.GetType ());                                \r\r
+                        }\r\r
+                }\r\r
+                \r\r
+                public void TestSqlInt32ToSqlString()\r\r
+                {\r\r
+                        SqlInt32 TestInt = new SqlInt32(-12456);\r\r
+                        AssertEquals ("#Y01", "-12456", ((SqlString)TestInt).Value);\r\r
+                        try {\r\r
+                                SqlString test = ((SqlString)SqlInt32.Null).Value;\r\r
+                                Fail ("#Y02");\r\r
+                        } catch (Exception e) {\r\r
+                                AssertEquals ("#Y03", typeof (SqlNullValueException), e.GetType ());                                \r\r
+                        }\r\r
+                }\r\r
+                \r\r
+                public void TestSqlInt64ToSqlString()\r\r
+                {\r\r
+                        SqlInt64 TestInt = new SqlInt64(10101010);\r\r
+                        AssertEquals ("#Z01", "10101010", ((SqlString)TestInt).Value);\r\r
+                }\r\r
+                \r\r
+                public void TestSqlMoneyToSqlString()\r\r
+                {\r\r
+                        SqlMoney TestMoney = new SqlMoney (646464.6464);\r\r
+                        AssertEquals ("#AA01", "646464.6464", ((SqlString)TestMoney).Value);\r\r
+                }\r\r
+                \r\r
+                public void TestSqlSingleToSqlString()\r\r
+                {\r\r
+                        SqlSingle TestSingle = new SqlSingle (3E+20);\r\r
+                        AssertEquals ("#AB01", "3E+20", ((SqlString)TestSingle).Value);\r\r
+                }\r\r
+                                              \r\r
+                public void TestSqlStringToString()\r\r
+                {\r\r
+                        AssertEquals ("#AC01", "First TestString",(String)Test1);                        \r\r
+                }\r\r
+\r\r
+                public void TestStringToSqlString()\r\r
+                {\r\r
+                        String TestString = "Test String";\r\r
+                        AssertEquals ("#AD01", "Test String", ((SqlString)TestString).Value);                        \r\r
+                }                \r\r
+        }\r\r
+}\r\r
+\r\r