-
Notifications
You must be signed in to change notification settings - Fork 933
/
Copy pathSQLiteDialectFixture.cs
98 lines (80 loc) · 2.81 KB
/
SQLiteDialectFixture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using NHibernate.Mapping;
namespace NHibernate.Test.DialectTest
{
using Dialect;
using NUnit.Framework;
using SqlCommand;
[TestFixture]
public class SQLiteDialectFixture
{
private SQLiteDialect dialect;
[SetUp]
public void SetUp()
{
dialect = new SQLiteDialect();
}
[Test]
public void SupportsSubSelect()
{
Assert.IsTrue(dialect.SupportsSubSelects);
}
[Test]
public void UseLimit()
{
SqlString sql = new SqlString("SELECT id, name, email FROM Users");
SqlString s = dialect.GetLimitString(sql, 5, 10);
Assert.AreEqual("SELECT id, name, email FROM Users limit 10 offset 5", s.ToString());
}
[Test]
public void QuotedSchemaNameWithSqlLite()
{
Table tbl = new Table();
tbl.Schema = "`schema`";
tbl.Name = "`name`";
Assert.AreEqual("\"schema_name\"", tbl.GetQualifiedName(dialect));
Assert.AreEqual("\"schema_table\"", dialect.Qualify("", "\"schema\"", "\"table\""));
}
[Test]
public void QuotedTableNameWithoutSchemaWithSqlLite()
{
Table tbl = new Table();
tbl.Name = "`name`";
Assert.AreEqual("\"name\"", tbl.GetQualifiedName(dialect));
}
[Test]
public void QuotedSchemaNameWithUnqoutedTableInSqlLite()
{
Table tbl = new Table();
tbl.Schema = "`schema`";
tbl.Name = "name";
Assert.AreEqual("\"schema_name\"", tbl.GetQualifiedName(dialect));
Assert.AreEqual("\"schema_table\"", dialect.Qualify("", "\"schema\"", "table"));
}
[Test]
public void QuotedCatalogSchemaNameWithSqlLite()
{
Table tbl = new Table();
tbl.Catalog = "dbo";
tbl.Schema = "`schema`";
tbl.Name = "`name`";
Assert.AreEqual("\"dbo_schema_name\"", tbl.GetQualifiedName(dialect));
Assert.AreEqual("\"dbo_schema_table\"", dialect.Qualify("dbo", "\"schema\"", "\"table\""));
}
[Test]
public void QuotedTableNameWithSqlLite()
{
Table tbl = new Table();
tbl.Name = "`Group`";
Assert.AreEqual("\"Group\"", tbl.GetQualifiedName(dialect));
}
[Test]
public void SchemaNameWithSqlLite()
{
Table tbl = new Table();
tbl.Schema = "schema";
tbl.Name = "name";
Assert.AreEqual("schema_name", tbl.GetQualifiedName(dialect));
Assert.AreEqual("schema_table", dialect.Qualify("", "schema", "table"));
}
}
}