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.Xml.XmlFunctionsTest Class Reference
Inheritance diagram for Deveel.Data.Xml.XmlFunctionsTest:
Deveel.Data.ContextBasedTest

Public Member Functions

void ToXmlType ()
 
void ExtractXml ()
 
void ExtractValue ()
 
void UpdateText ()
 
- 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 XmlFunctionsTest.cs.

Member Function Documentation

void Deveel.Data.Xml.XmlFunctionsTest.ExtractValue ( )
inline

Definition at line 53 of file XmlFunctionsTest.cs.

53  {
54  const string text = "EXTRACTVALUE(TO_XML('<root><child>value</child></root>'), '/root/child/text()')";
55 
56  var result = ParseAndInvoke(text);
57 
58  Assert.IsNotNull(result);
59  Assert.IsInstanceOf<StringType>(result.Type);
60  Assert.IsFalse(result.IsNull);
61  }
DataObject ParseAndInvoke(string text)
void Deveel.Data.Xml.XmlFunctionsTest.ExtractXml ( )
inline

Definition at line 42 of file XmlFunctionsTest.cs.

42  {
43  const string text = "EXTRACT(TO_XML('<root><child>value</child></root>'), '/root/child')";
44 
45  var result = ParseAndInvoke(text);
46 
47  Assert.IsNotNull(result);
48  Assert.IsInstanceOf<XmlNodeType>(result.Type);
49  Assert.IsFalse(result.IsNull);
50  }
DataObject ParseAndInvoke(string text)
DataObject Deveel.Data.Xml.XmlFunctionsTest.ParseAndInvoke ( string  text)
inlineprivate

Definition at line 19 of file XmlFunctionsTest.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.
static DataObject InvokeFunction(this IQuery query, Invoke invoke)
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.
override void Deveel.Data.Xml.XmlFunctionsTest.RegisterServices ( ServiceContainer  container)
inlineprotectedvirtual

Reimplemented from Deveel.Data.ContextBasedTest.

Definition at line 15 of file XmlFunctionsTest.cs.

15  {
16  container.UseXml();
17  }
void Deveel.Data.Xml.XmlFunctionsTest.ToXmlType ( )
inline

Definition at line 31 of file XmlFunctionsTest.cs.

31  {
32  const string text = "TO_XML('<root>value</root>')";
33 
34  var result = ParseAndInvoke(text);
35 
36  Assert.IsNotNull(result);
37  Assert.IsInstanceOf<XmlNodeType>(result.Type);
38  Assert.IsFalse(result.IsNull);
39  }
DataObject ParseAndInvoke(string text)
void Deveel.Data.Xml.XmlFunctionsTest.UpdateText ( )
inline

Definition at line 64 of file XmlFunctionsTest.cs.

64  {
65  const string text = "UPDATEXML(TO_XML('<root><child>value</child></root>'), '/root/child/text()', 'value2')";
66 
67  var result = ParseAndInvoke(text);
68 
69  Assert.IsNotNull(result);
70  Assert.IsInstanceOf<XmlNodeType>(result.Type);
71  Assert.IsFalse(result.IsNull);
72 
73  /*
74  TODO: must inspect why the text fails to compare...
75  var xmlNode = (SqlXmlNode) result.Value;
76  var updated = xmlNode.ToSqlString().Value;
77  var expected = "<root><child>value2</child></root>";
78  Assert.AreEqual(expected, updated);
79  */
80  }
DataObject ParseAndInvoke(string text)

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