DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | List of all members
Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests Class Reference

Public Member Functions

void NumericAndNumericAdd ()
 
void NumericAddToString ()
 
void NumericAndBooleanAdd ()
 
void StringAndStringAdd ()
 
void NumericAndNumericSubtract ()
 
void NumericAndBooleanSubtract ()
 
void NumericMultiply ()
 
void NumericDivide ()
 
void NumericModulo ()
 
void NumericEqualTo (double a, double b, bool expected)
 
void NumericNotEqualTo (double a, double b, bool expected)
 
void NumericGreaterThan (double a, double b, bool expected)
 
void NumericSmallerThan (double a, double b, bool expected)
 
void NumericOr (long a, long b, long expected)
 
void BooleanOr (bool a, bool b, bool expected)
 
void BooleanAnd (bool a, bool b, bool expected)
 
void NumericXOr (double a, double b, double expected)
 
void NumericAnd (long a, long b, long expected)
 
void NumericIsNullTrue ()
 
void NumericIsNullFalse ()
 
void StringLikesPattern (string input, string patern, bool expected)
 

Detailed Description

Definition at line 25 of file SqlBinaryExpressionTests.cs.

Member Function Documentation

void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.BooleanAnd ( bool  a,
bool  b,
bool  expected 
)
inline

Definition at line 343 of file SqlBinaryExpressionTests.cs.

343  {
344  var exp1 = SqlExpression.Constant(DataObject.Boolean(new SqlBoolean(a)));
345  var exp2 = SqlExpression.Constant(DataObject.Boolean(new SqlBoolean(b)));
346  var andExp = SqlExpression.And(exp1, exp2);
347 
348  SqlExpression resultExp = null;
349  Assert.DoesNotThrow(() => resultExp = andExp.Evaluate());
350  Assert.IsNotNull(resultExp);
351  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
352 
353  var constExp = (SqlConstantExpression)resultExp;
354  Assert.IsNotNull(constExp.Value.Value);
355  Assert.IsInstanceOf<BooleanType>(constExp.Value.Type);
356  Assert.IsInstanceOf<SqlBoolean>(constExp.Value.Value);
357 
358  var actual = ((SqlBoolean)constExp.Value.Value);
359  var expectedResult = new SqlBoolean(expected);
360  Assert.AreEqual(expectedResult, actual);
361  }
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.BooleanOr ( bool  a,
bool  b,
bool  expected 
)
inline

Definition at line 319 of file SqlBinaryExpressionTests.cs.

319  {
320  var exp1 = SqlExpression.Constant(DataObject.Boolean(new SqlBoolean(a)));
321  var exp2 = SqlExpression.Constant(DataObject.Boolean(new SqlBoolean(b)));
322  var orExp = SqlExpression.Or(exp1, exp2);
323 
324  SqlExpression resultExp = null;
325  Assert.DoesNotThrow(() => resultExp = orExp.Evaluate());
326  Assert.IsNotNull(resultExp);
327  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
328 
329  var constExp = (SqlConstantExpression)resultExp;
330  Assert.IsNotNull(constExp.Value.Value);
331  Assert.IsInstanceOf<BooleanType>(constExp.Value.Type);
332  Assert.IsInstanceOf<SqlBoolean>(constExp.Value.Value);
333 
334  var actual = ((SqlBoolean)constExp.Value.Value);
335  var expectedResult = new SqlBoolean(expected);
336  Assert.AreEqual(expectedResult, actual);
337  }
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericAddToString ( )
inline

Definition at line 49 of file SqlBinaryExpressionTests.cs.

49  {
50  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(4566, 10)));
51  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(8991.67, 10)));
52  var addExp = SqlExpression.Add(exp1, exp2);
53 
54  string s = null;
55  Assert.DoesNotThrow(() => s = addExp.ToString());
56  Assert.IsNotNull(s);
57  Assert.IsNotEmpty(s);
58  Assert.AreEqual("4566 + 8991.670000", s);
59  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericAnd ( long  a,
long  b,
long  expected 
)
inline

Definition at line 386 of file SqlBinaryExpressionTests.cs.

386  {
387  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(a)));
388  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(b)));
389  var orExp = SqlExpression.And(exp1, exp2);
390 
391  SqlExpression resultExp = null;
392  Assert.DoesNotThrow(() => resultExp = orExp.Evaluate());
393  Assert.IsNotNull(resultExp);
394  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
395 
396  var constExp = (SqlConstantExpression)resultExp;
397  Assert.IsNotNull(constExp.Value.Value);
398  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
399  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
400 
401  var actual = ((SqlNumber)constExp.Value.Value);
402  var expectedResult = new SqlNumber(expected);
403  Assert.AreEqual(expectedResult, actual);
404  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericAndBooleanAdd ( )
inline

Definition at line 62 of file SqlBinaryExpressionTests.cs.

62  {
63  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(4566)));
64  var exp2 = SqlExpression.Constant(DataObject.Boolean(true));
65  var addExp = SqlExpression.Add(exp1, exp2);
66 
67  SqlExpression resultExp = null;
68  Assert.DoesNotThrow(() => resultExp = addExp.Evaluate());
69  Assert.IsNotNull(resultExp);
70  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
71 
72  var constExp = (SqlConstantExpression) resultExp;
73  Assert.IsNotNull(constExp.Value.Value);
74  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
75  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
76 
77  var actual = ((SqlNumber) constExp.Value.Value).Round(2);
78  var expected = new SqlNumber(4567, 2);
79  Assert.AreEqual(expected, actual);
80  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericAndBooleanSubtract ( )
inline

Definition at line 123 of file SqlBinaryExpressionTests.cs.

123  {
124  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(325778.32)));
125  var exp2 = SqlExpression.Constant(DataObject.Boolean(true));
126  var subtractExp = SqlExpression.Subtract(exp1, exp2);
127 
128  SqlExpression resultExp = null;
129  Assert.DoesNotThrow(() => resultExp = subtractExp.Evaluate());
130  Assert.IsNotNull(resultExp);
131  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
132 
133  var constExp = (SqlConstantExpression)resultExp;
134  Assert.IsNotNull(constExp.Value.Value);
135  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
136  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
137  Assert.AreEqual(new SqlNumber(325777.32), (SqlNumber)constExp.Value.Value);
138  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericAndNumericAdd ( )
inline

Definition at line 27 of file SqlBinaryExpressionTests.cs.

27  {
28  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(4566, 10)));
29  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(8991.67, 10)));
30  var addExp = SqlExpression.Add(exp1, exp2);
31 
32  SqlExpression resultExp = null;
33  Assert.DoesNotThrow(() => resultExp = addExp.Evaluate());
34  Assert.IsNotNull(resultExp);
35  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
36 
37  var constExp = (SqlConstantExpression) resultExp;
38  Assert.IsNotNull(constExp.Value.Value);
39  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
40  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
41 
42  var actual = ((SqlNumber) constExp.Value.Value).Round(2);
43  var expected = new SqlNumber(13557.67, 2);
44 
45  Assert.AreEqual(expected, actual);
46  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericAndNumericSubtract ( )
inline

Definition at line 101 of file SqlBinaryExpressionTests.cs.

101  {
102  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(879987.47, 10)));
103  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(2577.14, 10)));
104  var subtractExp = SqlExpression.Subtract(exp1, exp2);
105 
106  SqlExpression resultExp = null;
107  Assert.DoesNotThrow(() => resultExp = subtractExp.Evaluate());
108  Assert.IsNotNull(resultExp);
109  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
110 
111  var constExp = (SqlConstantExpression)resultExp;
112  Assert.IsNotNull(constExp.Value.Value);
113  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
114  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
115 
116  var actual = ((SqlNumber) constExp.Value.Value).Round(2);
117  var expected = new SqlNumber(877410.33, 2);
118 
119  Assert.AreEqual(expected, actual);
120  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericDivide ( )
inline

Definition at line 162 of file SqlBinaryExpressionTests.cs.

162  {
163  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(49021.022)));
164  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(78.34)));
165  var divExp = SqlExpression.Divide(exp1, exp2);
166 
167  SqlExpression resultExp = null;
168  Assert.DoesNotThrow(() => resultExp = divExp.Evaluate());
169  Assert.IsNotNull(resultExp);
170  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
171 
172  var constExp = (SqlConstantExpression)resultExp;
173  Assert.IsNotNull(constExp.Value.Value);
174  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
175  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
176 
177  var actual = ((SqlNumber)constExp.Value.Value).Round(5);
178  var expected = new SqlNumber(625.74702, 5);
179  Assert.AreEqual(expected, actual);
180  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericEqualTo ( double  a,
double  b,
bool  expected 
)
inline

Definition at line 206 of file SqlBinaryExpressionTests.cs.

206  {
207  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(a)));
208  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(b)));
209  var eqExp = SqlExpression.Equal(exp1, exp2);
210 
211  SqlExpression resultExp = null;
212  Assert.DoesNotThrow(() => resultExp = eqExp.Evaluate());
213  Assert.IsNotNull(resultExp);
214  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
215 
216  var constExp = (SqlConstantExpression)resultExp;
217  Assert.IsNotNull(constExp.Value.Value);
218  Assert.IsInstanceOf<BooleanType>(constExp.Value.Type);
219  Assert.IsInstanceOf<SqlBoolean>(constExp.Value.Value);
220 
221  var actual = ((SqlBoolean)constExp.Value.Value);
222  var expectedResult = (SqlBoolean) expected;
223  Assert.AreEqual(expectedResult, actual);
224  }
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericGreaterThan ( double  a,
double  b,
bool  expected 
)
inline

Definition at line 252 of file SqlBinaryExpressionTests.cs.

252  {
253  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(a)));
254  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(b)));
255  var grExp = SqlExpression.GreaterThan(exp1, exp2);
256 
257  SqlExpression resultExp = null;
258  Assert.DoesNotThrow(() => resultExp = grExp.Evaluate());
259  Assert.IsNotNull(resultExp);
260  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
261 
262  var constExp = (SqlConstantExpression)resultExp;
263  Assert.IsNotNull(constExp.Value.Value);
264  Assert.IsInstanceOf<BooleanType>(constExp.Value.Type);
265  Assert.IsInstanceOf<SqlBoolean>(constExp.Value.Value);
266 
267  var actual = ((SqlBoolean)constExp.Value.Value);
268  var expectedResult = (SqlBoolean)expected;
269  Assert.AreEqual(expectedResult, actual);
270  }
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericIsNullFalse ( )
inline

Definition at line 428 of file SqlBinaryExpressionTests.cs.

428  {
429  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(747748)));
430  var exp2 = SqlExpression.Constant(DataObject.Null());
431  var orExp = SqlExpression.Is(exp1, exp2);
432 
433  SqlExpression resultExp = null;
434  Assert.DoesNotThrow(() => resultExp = orExp.Evaluate());
435  Assert.IsNotNull(resultExp);
436  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
437 
438  var constExp = (SqlConstantExpression)resultExp;
439  Assert.IsNotNull(constExp.Value.Value);
440  Assert.IsInstanceOf<BooleanType>(constExp.Value.Type);
441  Assert.IsInstanceOf<SqlBoolean>(constExp.Value.Value);
442 
443  var actual = ((SqlBoolean)constExp.Value.Value);
444  var expectedResult = new SqlBoolean(false);
445  Assert.AreEqual(expectedResult, actual);
446  }
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericIsNullTrue ( )
inline

Definition at line 407 of file SqlBinaryExpressionTests.cs.

407  {
408  var exp1 = SqlExpression.Constant(DataObject.Number(SqlNumber.Null));
409  var exp2 = SqlExpression.Constant(DataObject.Null());
410  var orExp = SqlExpression.Is(exp1, exp2);
411 
412  SqlExpression resultExp = null;
413  Assert.DoesNotThrow(() => resultExp = orExp.Evaluate());
414  Assert.IsNotNull(resultExp);
415  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
416 
417  var constExp = (SqlConstantExpression)resultExp;
418  Assert.IsNotNull(constExp.Value.Value);
419  Assert.IsInstanceOf<BooleanType>(constExp.Value.Type);
420  Assert.IsInstanceOf<SqlBoolean>(constExp.Value.Value);
421 
422  var actual = ((SqlBoolean)constExp.Value.Value);
423  var expectedResult = new SqlBoolean(true);
424  Assert.AreEqual(expectedResult, actual);
425  }
static readonly SqlNumber Null
Definition: SqlNumber.cs:31
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericModulo ( )
inline

Definition at line 183 of file SqlBinaryExpressionTests.cs.

183  {
184  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(892771.0623)));
185  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(9012)));
186  var modExp = SqlExpression.Modulo(exp1, exp2);
187 
188  SqlExpression resultExp = null;
189  Assert.DoesNotThrow(() => resultExp = modExp.Evaluate());
190  Assert.IsNotNull(resultExp);
191  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
192 
193  var constExp = (SqlConstantExpression)resultExp;
194  Assert.IsNotNull(constExp.Value.Value);
195  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
196  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
197 
198  var actual = ((SqlNumber)constExp.Value.Value).Round(4);
199  var expected = new SqlNumber(583.0623, 4);
200  Assert.AreEqual(expected, actual);
201  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericMultiply ( )
inline

Definition at line 141 of file SqlBinaryExpressionTests.cs.

141  {
142  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(56894.09)));
143  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(456)));
144  var mulExp = SqlExpression.Multiply(exp1, exp2);
145 
146  SqlExpression resultExp = null;
147  Assert.DoesNotThrow(() => resultExp = mulExp.Evaluate());
148  Assert.IsNotNull(resultExp);
149  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
150 
151  var constExp = (SqlConstantExpression)resultExp;
152  Assert.IsNotNull(constExp.Value.Value);
153  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
154  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
155 
156  var actual = ((SqlNumber) constExp.Value.Value).Round(2);
157  var expected = new SqlNumber(25943705.04, 2);
158  Assert.AreEqual(expected, actual);
159  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericNotEqualTo ( double  a,
double  b,
bool  expected 
)
inline

Definition at line 229 of file SqlBinaryExpressionTests.cs.

229  {
230  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(a)));
231  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(b)));
232  var eqExp = SqlExpression.NotEqual(exp1, exp2);
233 
234  SqlExpression resultExp = null;
235  Assert.DoesNotThrow(() => resultExp = eqExp.Evaluate());
236  Assert.IsNotNull(resultExp);
237  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
238 
239  var constExp = (SqlConstantExpression)resultExp;
240  Assert.IsNotNull(constExp.Value.Value);
241  Assert.IsInstanceOf<BooleanType>(constExp.Value.Type);
242  Assert.IsInstanceOf<SqlBoolean>(constExp.Value.Value);
243 
244  var actual = ((SqlBoolean)constExp.Value.Value);
245  var expectedResult = (SqlBoolean)expected;
246  Assert.AreEqual(expectedResult, actual);
247  }
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericOr ( long  a,
long  b,
long  expected 
)
inline

Definition at line 296 of file SqlBinaryExpressionTests.cs.

296  {
297  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(a)));
298  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(b)));
299  var orExp = SqlExpression.Or(exp1, exp2);
300 
301  SqlExpression resultExp = null;
302  Assert.DoesNotThrow(() => resultExp = orExp.Evaluate());
303  Assert.IsNotNull(resultExp);
304  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
305 
306  var constExp = (SqlConstantExpression)resultExp;
307  Assert.IsNotNull(constExp.Value.Value);
308  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
309  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
310 
311  var actual = ((SqlNumber)constExp.Value.Value);
312  var expectedResult = new SqlNumber(expected);
313  Assert.AreEqual(expectedResult, actual);
314  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericSmallerThan ( double  a,
double  b,
bool  expected 
)
inline

Definition at line 275 of file SqlBinaryExpressionTests.cs.

275  {
276  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(a)));
277  var exp2 = SqlExpression.Constant(DataObject.Number(new SqlNumber(b)));
278  var ltExp = SqlExpression.SmallerThan(exp1, exp2);
279 
280  SqlExpression resultExp = null;
281  Assert.DoesNotThrow(() => resultExp = ltExp.Evaluate());
282  Assert.IsNotNull(resultExp);
283  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
284 
285  var constExp = (SqlConstantExpression)resultExp;
286  Assert.IsNotNull(constExp.Value.Value);
287  Assert.IsInstanceOf<BooleanType>(constExp.Value.Type);
288  Assert.IsInstanceOf<SqlBoolean>(constExp.Value.Value);
289 
290  var actual = ((SqlBoolean)constExp.Value.Value);
291  var expectedResult = (SqlBoolean)expected;
292  Assert.AreEqual(expectedResult, actual);
293  }
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.NumericXOr ( double  a,
double  b,
double  expected 
)
inline

Definition at line 365 of file SqlBinaryExpressionTests.cs.

365  {
366  var exp1 = SqlExpression.Constant(DataObject.Double(a));
367  var exp2 = SqlExpression.Constant(DataObject.Double(b));
368  var xorExp = SqlExpression.XOr(exp1, exp2);
369 
370  SqlExpression resultExp = null;
371  Assert.DoesNotThrow(() => resultExp = xorExp.Evaluate());
372  Assert.IsNotNull(resultExp);
373  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
374 
375  var constExp = (SqlConstantExpression)resultExp;
376  Assert.IsNotNull(constExp.Value.Value);
377  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
378  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
379 
380  var actual = ((SqlNumber)constExp.Value.Value);
381  var expectedResult = new SqlNumber(expected);
382  Assert.AreEqual(expectedResult, actual);
383  }
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.StringAndStringAdd ( )
inline

Definition at line 83 of file SqlBinaryExpressionTests.cs.

83  {
84  var exp1 = SqlExpression.Constant(DataObject.String("The quick brown fox "));
85  var exp2 = SqlExpression.Constant(DataObject.VarChar("jumps over the lazy dog"));
86  var addExp = SqlExpression.Add(exp1, exp2);
87 
88  SqlExpression resultExp = null;
89  Assert.DoesNotThrow(() => resultExp = addExp.Evaluate());
90  Assert.IsNotNull(resultExp);
91  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
92 
93  var constExp = (SqlConstantExpression) resultExp;
94  Assert.IsNotNull(constExp.Value.Value);
95  Assert.IsInstanceOf<StringType>(constExp.Value.Type);
96  Assert.IsInstanceOf<SqlString>(constExp.Value.Value);
97  Assert.AreEqual(new SqlString("The quick brown fox jumps over the lazy dog"), (SqlString) constExp.Value.Value);
98  }
Deveel.Data.Sql.Objects.SqlString SqlString
Definition: DataObject.cs:27
void Deveel.Data.Sql.Expressions.SqlBinaryExpressionTests.StringLikesPattern ( string  input,
string  patern,
bool  expected 
)
inline

Definition at line 456 of file SqlBinaryExpressionTests.cs.

456  {
457  var exp1 = SqlExpression.Constant(DataObject.String(patern));
458  var exp2 = SqlExpression.Constant(DataObject.String(input));
459  var likeExp = SqlExpression.Like(exp1, exp2);
460 
461  SqlExpression resultExp = null;
462  Assert.DoesNotThrow(() => resultExp = likeExp.Evaluate());
463  Assert.IsNotNull(resultExp);
464  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
465 
466  var constExp = (SqlConstantExpression)resultExp;
467  Assert.IsNotNull(constExp.Value.Value);
468  Assert.IsInstanceOf<BooleanType>(constExp.Value.Type);
469  Assert.IsInstanceOf<SqlBoolean>(constExp.Value.Value);
470 
471  var actual = ((SqlBoolean)constExp.Value.Value);
472  var expectedResult = new SqlBoolean(expected);
473  Assert.AreEqual(expectedResult, actual);
474  }
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26

The documentation for this class was generated from the following file: