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

Public Member Functions

void NumericPlus (double a, double expected)
 
void NumericNegate (double a, double expected)
 
void BooleanNegate (bool a, bool expected)
 

Detailed Description

Definition at line 24 of file SqlUnaryExpressionTests.cs.

Member Function Documentation

void Deveel.Data.Sql.Expressions.SqlUnaryExpressionTests.BooleanNegate ( bool  a,
bool  expected 
)
inline

Definition at line 69 of file SqlUnaryExpressionTests.cs.

69  {
70  var exp1 = SqlExpression.Constant(DataObject.Boolean(a));
71  var negExp = SqlExpression.Negate(exp1);
72 
73  SqlExpression resultExp = null;
74  Assert.DoesNotThrow(() => resultExp = negExp.Evaluate());
75  Assert.IsNotNull(resultExp);
76  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
77 
78  var constExp = (SqlConstantExpression)resultExp;
79  Assert.IsNotNull(constExp.Value.Value);
80  Assert.IsInstanceOf<BooleanType>(constExp.Value.Type);
81  Assert.IsInstanceOf<SqlBoolean>(constExp.Value.Value);
82 
83  var actual = ((SqlBoolean)constExp.Value.Value);
84  var expectedResult = new SqlBoolean(expected);
85  Assert.AreEqual(expectedResult, actual);
86  }
Deveel.Data.Sql.Objects.SqlBoolean SqlBoolean
Definition: DataObject.cs:26
void Deveel.Data.Sql.Expressions.SqlUnaryExpressionTests.NumericNegate ( double  a,
double  expected 
)
inline

Definition at line 48 of file SqlUnaryExpressionTests.cs.

48  {
49  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(a)));
50  var negExp = SqlExpression.Negate(exp1);
51 
52  SqlExpression resultExp = null;
53  Assert.DoesNotThrow(() => resultExp = negExp.Evaluate());
54  Assert.IsNotNull(resultExp);
55  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
56 
57  var constExp = (SqlConstantExpression)resultExp;
58  Assert.IsNotNull(constExp.Value.Value);
59  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
60  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
61 
62  var actual = ((SqlNumber)constExp.Value.Value);
63  var expectedResult = new SqlNumber(expected);
64  Assert.AreEqual(expectedResult, actual);
65  }
void Deveel.Data.Sql.Expressions.SqlUnaryExpressionTests.NumericPlus ( double  a,
double  expected 
)
inline

Definition at line 27 of file SqlUnaryExpressionTests.cs.

27  {
28  var exp1 = SqlExpression.Constant(DataObject.Number(new SqlNumber(a)));
29  var plusExp = SqlExpression.UnaryPlus(exp1);
30 
31  SqlExpression resultExp = null;
32  Assert.DoesNotThrow(() => resultExp = plusExp.Evaluate());
33  Assert.IsNotNull(resultExp);
34  Assert.IsInstanceOf<SqlConstantExpression>(resultExp);
35 
36  var constExp = (SqlConstantExpression)resultExp;
37  Assert.IsNotNull(constExp.Value.Value);
38  Assert.IsInstanceOf<NumericType>(constExp.Value.Type);
39  Assert.IsInstanceOf<SqlNumber>(constExp.Value.Value);
40 
41  var actual = ((SqlNumber)constExp.Value.Value);
42  var expectedResult = new SqlNumber(expected);
43  Assert.AreEqual(expectedResult, actual);
44  }

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