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.Sql.Statements.DropTableStatementTests Class Reference
Inheritance diagram for Deveel.Data.Sql.Statements.DropTableStatementTests:
Deveel.Data.ContextBasedTest

Public Member Functions

void DropNonReferencedTable ()
 
void DropReferencedTable ()
 
void DropAllTables ()
 
- Public Member Functions inherited from Deveel.Data.ContextBasedTest
void TestSetUp ()
 
void TestFixtureSetUp ()
 
void TestTearDown ()
 
void TestFixtureTearDown ()
 

Protected Member Functions

override IQuery CreateQuery (ISession session)
 
- 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)
 
ISession CreateUserSession (string userName, string password)
 
virtual void OnSetUp (string testName)
 
virtual void OnTearDown ()
 

Private Member Functions

void CreateTestTables (IQuery context)
 

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 25 of file DropTableStatementTests.cs.

Member Function Documentation

override IQuery Deveel.Data.Sql.Statements.DropTableStatementTests.CreateQuery ( ISession  session)
inlineprotectedvirtual

Reimplemented from Deveel.Data.ContextBasedTest.

Definition at line 26 of file DropTableStatementTests.cs.

26  {
27  var query = base.CreateQuery(session);
28  CreateTestTables(query);
29  return query;
30  }
void Deveel.Data.Sql.Statements.DropTableStatementTests.CreateTestTables ( IQuery  context)
inlineprivate

Definition at line 32 of file DropTableStatementTests.cs.

32  {
33  var tn1 = ObjectName.Parse("APP.test_table1");
34  var tableInfo1 = new TableInfo(tn1);
35  tableInfo1.AddColumn(new ColumnInfo("id", PrimitiveTypes.Integer()));
36  tableInfo1.AddColumn(new ColumnInfo("name", PrimitiveTypes.String()));
37  tableInfo1.AddColumn(new ColumnInfo("date", PrimitiveTypes.DateTime()));
38  context.CreateTable(tableInfo1);
39  context.AddPrimaryKey(tn1, "id");
40 
41  var tn2 = ObjectName.Parse("APP.test_table2");
42  var tableInfo2 = new TableInfo(tn2);
43  tableInfo2.AddColumn(new ColumnInfo("id", PrimitiveTypes.Integer()));
44  tableInfo2.AddColumn(new ColumnInfo("other_id", PrimitiveTypes.Integer()));
45  tableInfo2.AddColumn(new ColumnInfo("count", PrimitiveTypes.Integer()));
46  context.CreateTable(tableInfo2);
47  context.AddPrimaryKey(tn2, "id");
48  context.AddForeignKey(tn2, new[] { "other_id" }, tn1, new[] { "id" }, ForeignKeyAction.Cascade, ForeignKeyAction.Cascade, null);
49  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
Defines the metadata properties of a column within a table of a database.
Definition: ColumnInfo.cs:36
ForeignKeyAction
Enumerates the foreign key referential trigger actions.
Defines the metadata properties of a table existing within a database.
Definition: TableInfo.cs:41
void Deveel.Data.Sql.Statements.DropTableStatementTests.DropAllTables ( )
inline

Definition at line 66 of file DropTableStatementTests.cs.

66  {
67  const string sql = "DROP TABLE IF EXISTS APP.test_table1, test_table2";
68 
69  Assert.DoesNotThrow(() => Query.ExecuteQuery(sql));
70  }
void Deveel.Data.Sql.Statements.DropTableStatementTests.DropNonReferencedTable ( )
inline

Definition at line 52 of file DropTableStatementTests.cs.

52  {
53  const string sql = "DROP TABLE test_table2";
54 
55  Assert.DoesNotThrow(() => Query.ExecuteQuery(sql));
56  }
void Deveel.Data.Sql.Statements.DropTableStatementTests.DropReferencedTable ( )
inline

Definition at line 59 of file DropTableStatementTests.cs.

59  {
60  const string sql = "DROP TABLE APP.test_table1";
61 
62  Assert.Throws<StatementException>(() => Query.ExecuteQuery(sql));
63  }

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