19 using NUnit.Framework;
21 namespace Deveel.Data.Sql.Objects {
23 [Category(
"SQL Objects")]
28 const string s =
"Test string UTF-16 LE";
30 Assert.IsNotNull(sqlString);
31 Assert.AreEqual(s.Length, sqlString.Length);
32 Assert.AreEqual(s, sqlString);
38 const string s =
"Test string in UTF-16 LE";
41 Assert.AreEqual(0, sqlString1.CompareTo(sqlString2));
47 const string s =
"Test string in UTF-16 LE";
50 Assert.IsTrue(sqlString1.Equals(sqlString2));
56 const string s1 =
"First string comes before the ";
57 const string s2 =
"Second string that comes after";
62 Assert.DoesNotThrow(() => sqlString3 = sqlString1.Concat(sqlString2));
63 Assert.AreEqual(
"First string comes before the Second string that comes after", sqlString3.ToString(Encoding.UTF8));
69 Assert.IsTrue(s.IsNull);
75 [Category(
"Conversion")]
76 [Category(
"Date Time")]
78 const string s =
"2011-01-23T23:44:21.525 +01:00";
83 Assert.IsFalse(timeStamp.IsNull);
84 Assert.AreEqual(2011, timeStamp.Year);
85 Assert.AreEqual(01, timeStamp.Month);
86 Assert.AreEqual(23, timeStamp.Day);
87 Assert.AreEqual(23, timeStamp.Hour);
88 Assert.AreEqual(44, timeStamp.Minute);
89 Assert.AreEqual(525, timeStamp.Millisecond);
90 Assert.AreEqual(1, timeStamp.Offset.Hours);
91 Assert.AreEqual(0, timeStamp.Offset.Minutes);
95 [Category(
"Conversion")]
96 [Category(
"Date Time")]
98 const string s =
"23:44:21.525";
103 Assert.IsFalse(time.IsNull);
104 Assert.AreEqual(1, time.Year);
105 Assert.AreEqual(1, time.Month);
106 Assert.AreEqual(1, time.Day);
107 Assert.AreEqual(23, time.Hour);
108 Assert.AreEqual(44, time.Minute);
109 Assert.AreEqual(21, time.Second);
110 Assert.AreEqual(525, time.Millisecond);
114 [Category(
"Conversion")]
115 [Category(
"Date Time")]
117 const string s =
"2011-01-23";
122 Assert.IsFalse(date.IsNull);
123 Assert.AreEqual(2011, date.Year);
124 Assert.AreEqual(01, date.Month);
125 Assert.AreEqual(23, date.Day);
126 Assert.AreEqual(0, date.Hour);
127 Assert.AreEqual(0, date.Minute);
128 Assert.AreEqual(0, date.Millisecond);
129 Assert.AreEqual(0, date.Offset.Hours);
130 Assert.AreEqual(0, date.Offset.Minutes);
134 [Category(
"Conversion")]
135 [Category(
"Numbers")]
137 const string s =
"7689994.0000033992988477226661525553666370058812345883288477383";
141 Assert.DoesNotThrow(() => number = (
SqlNumber)Convert.ChangeType(sqlString, typeof(
SqlNumber)));
142 Assert.IsFalse(number.IsNull);
143 Assert.IsFalse(number.CanBeInt32);
144 Assert.IsFalse(number.CanBeInt64);
149 [Category(
"Conversion")]
150 [Category(
"Booleans")]
152 const string s =
"true";
157 Assert.IsFalse(b.IsNull);
162 [Category(
"Conversion")]
163 [Category(
"Booleans")]
165 const string s =
"false";
170 Assert.IsFalse(b.IsNull);
175 [Category(
"Conversion")]
176 [Category(
"Booleans")]
183 Assert.IsTrue(b.IsNull);
NumericState
Lists all the possible special states of a number.
void String_Convert_BooleanFalse()
void String_Convert_Date()
void String_Convert_BooleanTrue()
void String_Convert_BigNumber()
static readonly SqlNull Value
void String_Compare_Equal()
void String_Convert_TimeStamp()
void String_Convert_BooleanNull()
void String_EqualsToNull()
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
void String_Convert_Time()
Deveel.Data.Sql.Objects.SqlString SqlString