20 using NUnit.Framework;
22 namespace Deveel.Data.Sql.Expressions {
30 Assert.DoesNotThrow(() => casted = exp.
Evaluate());
31 Assert.IsNotNull(casted);
35 Assert.IsNotNull(value.Value);
37 Assert.AreEqual(
SqlTypeCode.Integer, value.Type.TypeCode);
38 Assert.AreEqual(
new SqlNumber(1234), value.Value);
46 Assert.DoesNotThrow(() => casted = exp.
Evaluate());
47 Assert.IsNotNull(casted);
51 Assert.IsNotNull(value.Value);
53 Assert.AreEqual(
SqlTypeCode.Numeric, value.Type.TypeCode);
62 Assert.DoesNotThrow(() => casted = exp.
Evaluate());
63 Assert.IsNotNull(casted);
67 Assert.IsNotNull(value.Value);
68 Assert.IsInstanceOf<
DateType>(value.Type);
69 Assert.AreEqual(
SqlTypeCode.DateTime, value.Type.TypeCode);
70 Assert.AreEqual(
new SqlDateTime(2015, 09, 01), value.Value);
78 Assert.DoesNotThrow(() => casted = exp.
Evaluate());
79 Assert.IsNotNull(casted);
83 Assert.IsNotNull(value.Value);
84 Assert.IsInstanceOf<
DateType>(value.Type);
85 Assert.AreEqual(
SqlTypeCode.Date, value.Type.TypeCode);
86 Assert.AreEqual(
new SqlDateTime(2015, 09, 01), value.Value);
94 Assert.DoesNotThrow(() => casted = exp.
Evaluate());
95 Assert.IsNotNull(casted);
99 Assert.IsNotNull(value.Value);
100 Assert.IsInstanceOf<
DateType>(value.Type);
101 Assert.AreEqual(
SqlTypeCode.Time, value.Type.TypeCode);
107 var expected =
new SqlDateTime(1, 1, 1, 22, 13, 01, 0, result.Offset);
108 Assert.AreEqual(expected, result);
117 Assert.DoesNotThrow(() => casted = exp.
Evaluate());
118 Assert.IsNotNull(casted);
122 Assert.IsNotNull(value.Value);
124 Assert.AreEqual(
SqlTypeCode.Boolean, value.Type.TypeCode);
125 Assert.AreEqual(
SqlBoolean.True, value.Value);
133 Assert.DoesNotThrow(() => casted = exp.
Evaluate());
134 Assert.IsNotNull(casted);
138 Assert.IsNotNull(value.Value);
140 Assert.AreEqual(
SqlTypeCode.Boolean, value.Type.TypeCode);
141 Assert.AreEqual(
SqlBoolean.False, value.Value);
149 Assert.DoesNotThrow(() => casted = exp.
Evaluate());
150 Assert.IsNotNull(casted);
154 Assert.IsNotNull(value.Value);
156 Assert.AreEqual(
SqlTypeCode.String, value.Type.TypeCode);
165 Assert.DoesNotThrow(() => casted = exp.
Evaluate());
166 Assert.IsNotNull(casted);
170 Assert.IsNotNull(value.Value);
172 Assert.AreEqual(
SqlTypeCode.String, value.Type.TypeCode);
182 Assert.DoesNotThrow(() => casted = exp.
Evaluate());
183 Assert.IsNotNull(casted);
187 Assert.IsNotNull(value.Value);
189 Assert.AreEqual(
SqlTypeCode.String, value.Type.TypeCode);
195 Assert.Inconclusive();
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Date(DateTimeOffset value)
void CastStringToNumber()
static BooleanType Boolean()
void CastStringToBooleanFalse()
static NumericType Integer()
void CastStringToDateTime()
static DataObject String(string s)
static DataObject Boolean(SqlBoolean value)
void CastBooleanTrueToString()
DataObject Value
Gets the constant value of the expression.
virtual SqlExpression Evaluate(EvaluateContext context)
When overridden by a derived class, this method evaluates the expression within the provided context...
static NumericType Numeric()
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
static DateType DateTime()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
void CastStringToInteger()
An expression that holds a constant value.
static StringType String()
void CastNumberToString()
static SqlCastExpression Cast(SqlExpression value, SqlType destType)
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
static SqlNumber Parse(string s)
void CastStringToBooleanTrue()
Deveel.Data.Sql.Objects.SqlString SqlString
void CastBooleanFalseToString()