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

Public Member Functions

void BasicVarChar_Create ()
 
void BasicVarChar_Compare ()
 
void BasicVarChar_Add ()
 
void BasicVarChar_Convert_ToInteger_Success ()
 
void BasicVarChar_Convert_ToInteger_Fail ()
 
void BasicVarChar_Convert_ToBoolean_Success ()
 

Detailed Description

Definition at line 26 of file StringObjectTests.cs.

Member Function Documentation

void Deveel.Data.StringObjectTests.BasicVarChar_Add ( )
inline

Definition at line 52 of file StringObjectTests.cs.

52  {
53  const string s1 = "First test string that comes ";
54  const string s2 = "before the second test string";
55  var sObj1 = DataObject.VarChar(s1);
56  var sObj2 = DataObject.VarChar(s2);
57 
58  Assert.IsNotNull(sObj1);
59  Assert.IsNotNull(sObj2);
60 
61  Assert.IsTrue(sObj1.IsComparableTo(sObj2));
62 
63  DataObject result = null;
64  Assert.DoesNotThrow(() => result = sObj1.Add(sObj2));
65  Assert.IsNotNull(result);
66  Assert.AreEqual("First test string that comes before the second test string", (string)result);
67  }
void Deveel.Data.StringObjectTests.BasicVarChar_Compare ( )
inline

Definition at line 39 of file StringObjectTests.cs.

39  {
40  const string s = "Test string";
41  var sObj1 = DataObject.VarChar(s);
42  var sObj2 = DataObject.VarChar(s);
43 
44  Assert.IsNotNull(sObj1);
45  Assert.IsNotNull(sObj2);
46 
47  Assert.IsTrue(sObj1.IsComparableTo(sObj2));
48  Assert.AreEqual(0, sObj1.CompareTo(sObj2));
49  }
void Deveel.Data.StringObjectTests.BasicVarChar_Convert_ToBoolean_Success ( )
inline

Definition at line 105 of file StringObjectTests.cs.

105  {
106  const string s = "true";
107  var obj = DataObject.VarChar(s);
108 
109  Assert.IsNotNull(obj);
110  Assert.IsInstanceOf<StringType>(obj.Type);
111  Assert.AreEqual(SqlTypeCode.VarChar, obj.Type.TypeCode);
112 
113  DataObject result = null;
114  Assert.DoesNotThrow(() => result = obj.CastTo(PrimitiveTypes.Boolean()));
115  Assert.IsNotNull(result);
116  Assert.IsInstanceOf<BooleanType>(result.Type);
117  Assert.IsFalse(result.IsNull);
118  Assert.AreEqual(true, (bool)result);
119  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static BooleanType Boolean()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
void Deveel.Data.StringObjectTests.BasicVarChar_Convert_ToInteger_Fail ( )
inline

Definition at line 88 of file StringObjectTests.cs.

88  {
89  const string s = "fail";
90  var obj = DataObject.VarChar(s);
91 
92  Assert.IsNotNull(obj);
93  Assert.IsInstanceOf<StringType>(obj.Type);
94  Assert.AreEqual(SqlTypeCode.VarChar, obj.Type.TypeCode);
95 
96  DataObject result = null;
97  Assert.DoesNotThrow(() => result = obj.CastTo(PrimitiveTypes.Numeric(SqlTypeCode.Integer)));
98  Assert.IsNotNull(result);
99  Assert.IsInstanceOf<NumericType>(result.Type);
100  Assert.IsTrue(result.IsNull);
101  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static NumericType Numeric()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
void Deveel.Data.StringObjectTests.BasicVarChar_Convert_ToInteger_Success ( )
inline

Definition at line 70 of file StringObjectTests.cs.

70  {
71  const string s = "78998";
72  var obj = DataObject.VarChar(s);
73 
74  Assert.IsNotNull(obj);
75  Assert.IsInstanceOf<StringType>(obj.Type);
76  Assert.AreEqual(SqlTypeCode.VarChar, obj.Type.TypeCode);
77 
78  DataObject result = null;
79  Assert.DoesNotThrow(() => result = obj.CastTo(PrimitiveTypes.Numeric(SqlTypeCode.Integer)));
80  Assert.IsNotNull(result);
81  Assert.IsInstanceOf<NumericType>(result.Type);
82  Assert.AreEqual(SqlTypeCode.Integer, result.Type.TypeCode);
83  Assert.AreEqual(78998, result);
84  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static NumericType Numeric()
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23
void Deveel.Data.StringObjectTests.BasicVarChar_Create ( )
inline

Definition at line 28 of file StringObjectTests.cs.

28  {
29  const string s = "Test string";
30  var sObj = DataObject.VarChar(s);
31  Assert.IsNotNull(sObj);
32  Assert.IsInstanceOf<DataObject>(sObj);
33  Assert.AreEqual(SqlTypeCode.VarChar, sObj.Type.TypeCode);
34  Assert.IsInstanceOf<SqlString>(sObj.Value);
35  Assert.AreEqual(s, sObj.Value);
36  }
SqlTypeCode
Enumerates the codes of all SQL types handled by the system.
Definition: SqlTypeCode.cs:23

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