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

Public Member Functions

void PointFromWkt ()
 
void DistanceCalculate ()
 
- Public Member Functions inherited from Deveel.Data.ContextBasedTest
void TestSetUp ()
 
void TestFixtureSetUp ()
 
void TestTearDown ()
 
void TestFixtureTearDown ()
 

Protected Member Functions

override void RegisterServices (ServiceContainer container)
 
- Protected Member Functions inherited from Deveel.Data.ContextBasedTest
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 ()
 

Private Member Functions

DataObject ParseAndInvoke (string text)
 

Additional Inherited Members

- 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 14 of file SpatialFunctionsTest.cs.

Member Function Documentation

void Deveel.Data.Spatial.SpatialFunctionsTest.DistanceCalculate ( )
inline

Definition at line 48 of file SpatialFunctionsTest.cs.

48  {
49  const string text = "DISTANCE(FROM_WKT('POINT(59.9308785 10.7893356)'), FROM_WKT('POINT(59.9284945 10.7786121)'))";
50 
51  var result = ParseAndInvoke(text);
52 
53  Assert.IsNotNull(result);
54  Assert.IsFalse(result.IsNull);
55 
56  Assert.IsInstanceOf<NumericType>(result.Type);
57 
58  var number = (SqlNumber) result.Value;
59 
60  // TODO: Assess the distance is right
61  }
DataObject Deveel.Data.Spatial.SpatialFunctionsTest.ParseAndInvoke ( string  text)
inlineprivate

Definition at line 19 of file SpatialFunctionsTest.cs.

19  {
20  var exp = SqlExpression.Parse(text);
21  Assert.IsInstanceOf<SqlFunctionCallExpression>(exp);
22 
23  var functionName = ((SqlFunctionCallExpression) exp).FunctioName;
24  var args = ((SqlFunctionCallExpression) exp).Arguments;
25  var invoke = new Invoke(functionName, args);
26 
27  return Query.InvokeFunction(invoke);
28  }
static SqlExpression Parse(string s)
Parses the given SQL string to an expression that can be evaluated.
The information about the invocation of a routine, including the full name and arguments (as SqlExpre...
Definition: Invoke.cs:30
Defines the base class for instances that represent SQL expression tree nodes.
void Deveel.Data.Spatial.SpatialFunctionsTest.PointFromWkt ( )
inline

Definition at line 31 of file SpatialFunctionsTest.cs.

31  {
32  const string text = "FROM_WKT('POINT(50.100299 12.3399)')";
33 
34  var result = ParseAndInvoke(text);
35 
36  Assert.IsNotNull(result);
37  Assert.IsFalse(result.IsNull);
38 
39  Assert.IsInstanceOf<SpatialType>(result.Type);
40 
41  var geometry = (SqlGeometry) result.Value;
42 
43  // TODO: Vrify strings equal to SqlString
44  // Assert.AreEqual("POINT", geometry.GeometryType.ToString());
45  }
override void Deveel.Data.Spatial.SpatialFunctionsTest.RegisterServices ( ServiceContainer  container)
inlineprotectedvirtual

Reimplemented from Deveel.Data.ContextBasedTest.

Definition at line 15 of file SpatialFunctionsTest.cs.

15  {
16  container.UseSpatial();
17  }

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