18 using NUnit.Framework;
20 namespace Deveel.Data.Sql.Objects {
22 [Category(
"SQL Objects")]
23 [Category(
"Booleans")]
28 Assert.IsNotNull(value);
29 Assert.IsFalse(value.IsNull);
30 Assert.AreEqual(
true, (
bool)value);
33 Assert.IsNotNull(value);
34 Assert.IsFalse(value.IsNull);
35 Assert.AreEqual(
false, (
bool)value);
41 Assert.IsNotNull(value);
42 Assert.IsFalse(value.IsNull);
43 Assert.AreEqual(
true, (
bool)value);
46 Assert.IsNotNull(value);
47 Assert.IsFalse(value.IsNull);
48 Assert.AreEqual(
false, (
bool)value);
52 [Category(
"Comparison")]
57 Assert.IsFalse(value1.IsNull);
58 Assert.IsFalse(value2.IsNull);
60 Assert.IsTrue(value1.IsComparableTo(value2));
63 Assert.DoesNotThrow(() => i = value1.CompareTo(value2));
64 Assert.AreEqual(0, i);
68 [Category(
"Comparison")]
73 Assert.IsFalse(value1.IsNull);
74 Assert.IsFalse(value2.IsNull);
76 Assert.IsTrue(value1.IsComparableTo(value2));
79 Assert.DoesNotThrow(() => i = value1.CompareTo(value2));
80 Assert.AreEqual(-1, i);
84 [Category(
"Comparison")]
89 Assert.IsFalse(value1.IsNull);
90 Assert.IsTrue(value2.IsNull);
92 Assert.IsTrue(value1.IsComparableTo(value2));
95 Assert.DoesNotThrow(() => i = value1.CompareTo(value2));
96 Assert.AreEqual(1, i);
100 [Category(
"Comparison")]
105 Assert.IsFalse(value1.IsNull);
106 Assert.IsTrue(value2.IsNull);
108 Assert.IsTrue(value1.IsComparableTo(value2));
111 Assert.DoesNotThrow(() => i = value1.CompareTo(value2));
112 Assert.AreEqual(1, i);
116 [Category(
"Comparison")]
117 [Category(
"Numbers")]
122 Assert.IsFalse(value1.IsNull);
123 Assert.IsFalse(value2.IsNull);
125 Assert.IsTrue(value1.IsComparableTo(value2));
128 Assert.DoesNotThrow(() => i = value1.CompareTo(value2));
129 Assert.AreEqual(0, i);
133 Assert.IsFalse(value1.IsNull);
134 Assert.IsFalse(value2.IsNull);
136 Assert.IsTrue(value1.IsComparableTo(value2));
139 Assert.DoesNotThrow(() => i = value1.CompareTo(value2));
140 Assert.AreEqual(1, i);
144 [Category(
"Comparison")]
145 [Category(
"Numbers")]
150 Assert.IsFalse(value1.IsNull);
151 Assert.IsFalse(value2.IsNull);
153 Assert.IsFalse(value1.IsComparableTo(value2));
156 Assert.Throws<ArgumentOutOfRangeException>(() => i = value1.CompareTo(value2));
157 Assert.AreEqual(-2, i);
161 [Category(
"Operators")]
166 Assert.IsTrue(value1 == value2);
170 [Category(
"Operators")]
175 Assert.IsTrue(value1 != value2);
179 Assert.IsTrue(value1 != value2);
183 [Category(
"Operators")]
188 Assert.IsTrue(value1 == value2);
192 [Category(
"Conversion")]
195 Assert.AreEqual(
"true", value.ToString());
198 Assert.AreEqual(
"false", value.ToString());
201 Assert.AreEqual(
"NULL", value.ToString());
void Compare_ToBooleanNull()
void Compare_ToNumber_InRange()
static readonly SqlNull Value
static readonly SqlNumber Zero
static readonly SqlNumber One
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
void Compare_ToNumber_OutOfRange()
void Equality_ToNull_True()