DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Private Member Functions | List of all members
Deveel.Data.Routines.SystemFunctionTests Class Reference
Inheritance diagram for Deveel.Data.Routines.SystemFunctionTests:
Deveel.Data.ContextBasedTest

Public Member Functions

void ResolveSystemFunctionWithNoSchema ()
 
void ResolveSystemFunctionFullyQualified ()
 
void InvokeUserFunction ()
 
void InvokeIntegerToString ()
 
void InvokeDateToString ()
 
void InvokeTimeStampToString_NoFormat ()
 
- Public Member Functions inherited from Deveel.Data.ContextBasedTest
void TestSetUp ()
 
void TestFixtureSetUp ()
 
void TestTearDown ()
 
void TestFixtureTearDown ()
 

Private Member Functions

DataObject InvokeFunction (string name)
 
DataObject InvokeFunction (string name, DataObject arg)
 

Additional Inherited Members

- Protected Member Functions inherited from Deveel.Data.ContextBasedTest
virtual void RegisterServices (ServiceContainer container)
 
virtual ISystem CreateSystem ()
 
virtual IDatabase CreateDatabase (ISystem system, IConfiguration configuration)
 
virtual ISession CreateAdminSession (IDatabase database)
 
virtual IQuery CreateQuery (ISession session)
 
ISession CreateUserSession (string userName, string password)
 
virtual void OnSetUp (string testName)
 
virtual void OnTearDown ()
 
- Protected Attributes inherited from Deveel.Data.ContextBasedTest
const string AdminUserName = "SA"
 
const string AdminPassword = "1234567890"
 
const string DatabaseName = "testdb"
 
- Properties inherited from Deveel.Data.ContextBasedTest
virtual bool SingleContext [get]
 
IQuery Query [get, private set]
 
ISystem System [get, private set]
 
IDatabase Database [get, private set]
 
ISession Session [get, private set]
 

Detailed Description

Definition at line 27 of file SystemFunctionTests.cs.

Member Function Documentation

void Deveel.Data.Routines.SystemFunctionTests.InvokeDateToString ( )
inline

Definition at line 75 of file SystemFunctionTests.cs.

75  {
76  var value = DataObject.Date(new SqlDateTime(2015, 02, 10));
77  DataObject result = null;
78  Assert.DoesNotThrow(() => result = InvokeFunction("TOSTRING", value));
79  Assert.IsNotNull(result);
80  Assert.IsInstanceOf<StringType>(result.Type);
81 
82  var stringResult = result.Value.ToString();
83  Assert.AreEqual("2015-02-10", stringResult);
84  }
static DataObject Date(DateTimeOffset value)
Definition: DataObject.cs:600
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
DataObject Deveel.Data.Routines.SystemFunctionTests.InvokeFunction ( string  name)
inlineprivate

Definition at line 28 of file SystemFunctionTests.cs.

28  {
29  return Query.InvokeSystemFunction(name);
30  }
DataObject Deveel.Data.Routines.SystemFunctionTests.InvokeFunction ( string  name,
DataObject  arg 
)
inlineprivate

Definition at line 32 of file SystemFunctionTests.cs.

32  {
33  return Query.InvokeSystemFunction(name, SqlExpression.Constant(arg));
34  }
Defines the base class for instances that represent SQL expression tree nodes.
static SqlConstantExpression Constant(object value)
void Deveel.Data.Routines.SystemFunctionTests.InvokeIntegerToString ( )
inline

Definition at line 63 of file SystemFunctionTests.cs.

63  {
64  var value = DataObject.Integer(455366);
65  DataObject result = null;
66  Assert.DoesNotThrow(() => result = InvokeFunction("TOSTRING", value));
67  Assert.IsNotNull(result);
68  Assert.IsInstanceOf<StringType>(result.Type);
69 
70  var stringResult = result.Value.ToString();
71  Assert.AreEqual("455366", stringResult);
72  }
static DataObject Integer(int value)
Definition: DataObject.cs:576
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
void Deveel.Data.Routines.SystemFunctionTests.InvokeTimeStampToString_NoFormat ( )
inline

Definition at line 87 of file SystemFunctionTests.cs.

87  {
88  var value = DataObject.TimeStamp(new SqlDateTime(2015, 02, 10, 17, 15, 01,00));
89  DataObject result = null;
90  Assert.DoesNotThrow(() => result = InvokeFunction("TOSTRING", value));
91  Assert.IsNotNull(result);
92  Assert.IsInstanceOf<StringType>(result.Type);
93 
94  var stringResult = result.Value.ToString();
95  Assert.AreEqual("2015-02-10T17:15:01.000 +00:00", stringResult);
96  }
SqlType Type
Gets the SqlType that defines the object properties
Definition: DataObject.cs:78
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
static DataObject TimeStamp(SqlDateTime value)
Definition: DataObject.cs:610
void Deveel.Data.Routines.SystemFunctionTests.InvokeUserFunction ( )
inline

Definition at line 55 of file SystemFunctionTests.cs.

55  {
56  DataObject result = null;
57  Assert.DoesNotThrow(() => result = InvokeFunction("user"));
58  Assert.IsNotNull(result);
59  Assert.AreEqual(AdminUserName, result.Value.ToString());
60  }
ISqlObject Value
Gets the underlined value that is handled.
Definition: DataObject.cs:84
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
Definition: DataObject.cs:35
void Deveel.Data.Routines.SystemFunctionTests.ResolveSystemFunctionFullyQualified ( )
inline

Definition at line 46 of file SystemFunctionTests.cs.

46  {
47  IFunction function = null;
48  Assert.DoesNotThrow(() => function = Query.ResolveFunction(ObjectName.Parse("SYSTEM.user")));
49  Assert.IsNotNull(function);
50  Assert.AreEqual(SystemSchema.Name, function.FullName.ParentName);
51  Assert.AreEqual("user", function.FullName.Name);
52  }
static ObjectName Parse(string s)
Parses the given string into a ObjectName object.
Definition: ObjectName.cs:139
Describes the name of an object within a database.
Definition: ObjectName.cs:44
Provides utilities and properties for handling the SYSTEN schema of a database.
Definition: SystemSchema.cs:37
const string Name
The name of the system schema that contains tables referring to system information.
void Deveel.Data.Routines.SystemFunctionTests.ResolveSystemFunctionWithNoSchema ( )
inline

Definition at line 37 of file SystemFunctionTests.cs.

37  {
38  IFunction function = null;
39  Assert.DoesNotThrow(() => function = Query.ResolveFunction(new ObjectName("user")));
40  Assert.IsNotNull(function);
41  Assert.AreEqual(SystemSchema.Name, function.FullName.ParentName);
42  Assert.AreEqual("user", function.FullName.Name);
43  }
Describes the name of an object within a database.
Definition: ObjectName.cs:44
Provides utilities and properties for handling the SYSTEN schema of a database.
Definition: SystemSchema.cs:37
const string Name
The name of the system schema that contains tables referring to system information.

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