DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
SchemaCompileTests.cs
Go to the documentation of this file.
1 using System;
2 using System.Linq;
3 
5 
6 using NUnit.Framework;
7 
8 namespace Deveel.Data.Sql.Compile {
9  [TestFixture]
11  [Test]
12  public void CreateSchema() {
13  const string sql = "CREATE SCHEMA test_schema";
14 
15  var result = Compile(sql);
16 
17  Assert.IsNotNull(result);
18  Assert.IsFalse(result.HasErrors);
19 
20  Assert.IsNotEmpty(result.Statements);
21  Assert.AreEqual(1, result.Statements.Count);
22 
23  var statement = result.Statements.FirstOrDefault();
24 
25  Assert.IsNotNull(statement);
26  Assert.IsInstanceOf<CreateSchemaStatement>(statement);
27 
28  var schemaStatement = (CreateSchemaStatement) statement;
29  Assert.AreEqual("test_schema", schemaStatement.SchemaName);
30  }
31 
32  [Test]
33  public void DropSchema() {
34  const string sql = "DROP SCHEMA test_schema";
35 
36  var result = Compile(sql);
37 
38  Assert.IsNotNull(result);
39  Assert.IsFalse(result.HasErrors);
40 
41  Assert.IsNotEmpty(result.Statements);
42  Assert.AreEqual(1, result.Statements.Count);
43 
44  var statement = result.Statements.FirstOrDefault();
45 
46  Assert.IsNotNull(statement);
47 
48  Assert.IsInstanceOf<DropSchemaStatement>(statement);
49 
50  var schemaStatement = (DropSchemaStatement) statement;
51  Assert.AreEqual("test_schema", schemaStatement.SchemaName);
52  }
53  }
54 }