Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit efb4529

Browse files
committed
pgsql test fixes
1 parent 1a8e895 commit efb4529

File tree

3 files changed

+25
-28
lines changed

3 files changed

+25
-28
lines changed

tests/ServiceStack.OrmLite.Tests/AutoQueryTests.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ public void Can_use_dynamic_apis_on_Custom_Select()
212212
var resultsMap = db.Select<Dictionary<string, object>>(q);
213213
Assert.That(resultsMap.Count, Is.EqualTo(2));
214214
var row = new Dictionary<string,object>(resultsMap[0], StringComparer.OrdinalIgnoreCase);
215-
Assert.That(row.ContainsKey("FirstName"));
216-
Assert.That(!row.ContainsKey("Id"));
215+
Assert.That(row.ContainsKey("FirstName".SqlTableRaw()));
216+
Assert.That(!row.ContainsKey("Id".SqlTableRaw()));
217217

218218
var resultsList = db.Select<List<object>>(q);
219219
Assert.That(resultsList.Count, Is.EqualTo(2));
@@ -222,16 +222,9 @@ public void Can_use_dynamic_apis_on_Custom_Select()
222222
var resultsDynamic = db.Select<dynamic>(q);
223223
Assert.That(resultsDynamic.Count, Is.EqualTo(2));
224224
var map = (IDictionary<string, object>) resultsDynamic[0];
225-
if (Dialect != Dialect.Firebird)
226-
{
227-
Assert.That(map.ContainsKey("FirstName"));
228-
Assert.That(!map.ContainsKey("Id"));
229-
}
230-
else
231-
{
232-
Assert.That(map.ContainsKey("FIRSTNAME"));
233-
Assert.That(!map.ContainsKey("ID"));
234-
}
225+
226+
Assert.That(map.ContainsKey("FirstName".SqlTableRaw()));
227+
Assert.That(!map.ContainsKey("Id".SqlTableRaw()));
235228
}
236229
}
237230

tests/ServiceStack.OrmLite.Tests/ExpressionVisitorTests.cs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,27 @@ public void Setup()
1919
{
2020
using (var db = OpenDbConnection())
2121
{
22-
db.DropAndCreateTable<TestType>();
23-
db.Insert(new TestType { Id = 1, BoolCol = true, DateCol = new DateTime(2012, 1, 1), TextCol = "asdf", EnumCol = TestEnum.Val0, NullableIntCol = 10, TestType2ObjColId = 1 });
24-
db.Insert(new TestType { Id = 2, BoolCol = true, DateCol = new DateTime(2012, 2, 1), TextCol = "asdf123", EnumCol = TestEnum.Val1, NullableIntCol = null, TestType2ObjColId = 2 });
25-
db.Insert(new TestType { Id = 3, BoolCol = false, DateCol = new DateTime(2012, 3, 1), TextCol = "qwer", EnumCol = TestEnum.Val2, NullableIntCol = 30, TestType2ObjColId = 3 });
26-
db.Insert(new TestType { Id = 4, BoolCol = false, DateCol = new DateTime(2012, 4, 1), TextCol = "qwer123", EnumCol = TestEnum.Val3, NullableIntCol = 40, TestType2ObjColId = 4 });
22+
db.DropTable<TestType>();
23+
db.DropTable<TestType2>();
24+
db.DropTable<TestType3>();
25+
26+
db.CreateTable<TestType3>();
27+
db.Insert(new TestType3 { Id = 1, BoolCol = true, DateCol = new DateTime(2012, 4, 1), TextCol = "111", EnumCol = TestEnum.Val3, NullableIntCol = 10, TestType3Name = "3.1", CustomInt = 100 });
28+
db.Insert(new TestType3 { Id = 2, BoolCol = false, DateCol = new DateTime(2012, 4, 1), TextCol = "222", EnumCol = TestEnum.Val3, NullableIntCol = 20, TestType3Name = "3.2", CustomInt = 200 });
29+
db.Insert(new TestType3 { Id = 3, BoolCol = false, DateCol = new DateTime(2012, 4, 1), TextCol = "222", EnumCol = TestEnum.Val3, NullableIntCol = 30, TestType3Name = "3.3", CustomInt = 300 });
30+
db.Insert(new TestType3 { Id = 4, BoolCol = false, DateCol = new DateTime(2012, 4, 1), TextCol = "222", EnumCol = TestEnum.Val3, NullableIntCol = 40, TestType3Name = "3.4", CustomInt = 400 });
2731

28-
db.DropAndCreateTable<TestType2>();
29-
db.Insert(new TestType2 { Id = 1, BoolCol = true, DateCol = new DateTime(2012, 4, 1), TextCol = "111", EnumCol = TestEnum.Val3, NullableIntCol = 10, TestType2Name = "2.1", TestType3ObjColId = 1});
32+
db.CreateTable<TestType2>();
33+
db.Insert(new TestType2 { Id = 1, BoolCol = true, DateCol = new DateTime(2012, 4, 1), TextCol = "111", EnumCol = TestEnum.Val3, NullableIntCol = 10, TestType2Name = "2.1", TestType3ObjColId = 1 });
3034
db.Insert(new TestType2 { Id = 2, BoolCol = false, DateCol = new DateTime(2012, 4, 1), TextCol = "222", EnumCol = TestEnum.Val3, NullableIntCol = 20, TestType2Name = "2.2", TestType3ObjColId = 2 });
3135
db.Insert(new TestType2 { Id = 3, BoolCol = true, DateCol = new DateTime(2012, 4, 1), TextCol = "333", EnumCol = TestEnum.Val3, NullableIntCol = 30, TestType2Name = "2.3", TestType3ObjColId = 3 });
3236
db.Insert(new TestType2 { Id = 4, BoolCol = false, DateCol = new DateTime(2012, 4, 1), TextCol = "444", EnumCol = TestEnum.Val3, NullableIntCol = 40, TestType2Name = "2.4", TestType3ObjColId = 4 });
3337

34-
35-
db.DropAndCreateTable<TestType3>();
36-
db.Insert(new TestType3 { Id = 1, BoolCol = true, DateCol = new DateTime(2012, 4, 1), TextCol = "111", EnumCol = TestEnum.Val3, NullableIntCol = 10, TestType3Name = "3.1", CustomInt = 100});
37-
db.Insert(new TestType3 { Id = 2, BoolCol = false, DateCol = new DateTime(2012, 4, 1), TextCol = "222", EnumCol = TestEnum.Val3, NullableIntCol = 20, TestType3Name = "3.2", CustomInt = 200 });
38-
db.Insert(new TestType3 { Id = 3, BoolCol = false, DateCol = new DateTime(2012, 4, 1), TextCol = "222", EnumCol = TestEnum.Val3, NullableIntCol = 30, TestType3Name = "3.3", CustomInt = 300});
39-
db.Insert(new TestType3 { Id = 4, BoolCol = false, DateCol = new DateTime(2012, 4, 1), TextCol = "222", EnumCol = TestEnum.Val3, NullableIntCol = 40, TestType3Name = "3.4", CustomInt = 400 });
38+
db.CreateTable<TestType>();
39+
db.Insert(new TestType { Id = 1, BoolCol = true, DateCol = new DateTime(2012, 1, 1), TextCol = "asdf", EnumCol = TestEnum.Val0, NullableIntCol = 10, TestType2ObjColId = 1 });
40+
db.Insert(new TestType { Id = 2, BoolCol = true, DateCol = new DateTime(2012, 2, 1), TextCol = "asdf123", EnumCol = TestEnum.Val1, NullableIntCol = null, TestType2ObjColId = 2 });
41+
db.Insert(new TestType { Id = 3, BoolCol = false, DateCol = new DateTime(2012, 3, 1), TextCol = "qwer", EnumCol = TestEnum.Val2, NullableIntCol = 30, TestType2ObjColId = 3 });
42+
db.Insert(new TestType { Id = 4, BoolCol = false, DateCol = new DateTime(2012, 4, 1), TextCol = "qwer123", EnumCol = TestEnum.Val3, NullableIntCol = 40, TestType2ObjColId = 4 });
4043
}
4144
Db = OpenDbConnection();
4245
}
@@ -118,7 +121,8 @@ public void Can_Select_using_new_ComplexType()
118121
DateCol = new DateTime(2012, 5, 1),
119122
TextCol = "uiop",
120123
EnumCol = TestEnum.Val3,
121-
ComplexObjCol = new TestType { TextCol = "poiu" }
124+
ComplexObjCol = new TestType { TextCol = "poiu" },
125+
TestType2ObjColId = 1
122126
});
123127

124128
var target = Db.Select<TestType>(

tests/ServiceStack.OrmLite.Tests/OrmLiteCreateTableTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,8 @@ public void Does_not_create_table_with_ignored_field()
473473
{
474474
db.DropAndCreateTable<TableWithIgnoredFields>();
475475

476-
Assert.That(db.GetLastSql().ToLower(), Is.StringContaining("displayname"));
477-
Assert.That(db.GetLastSql().ToLower(), Is.Not.StringContaining("isignored"));
476+
Assert.That(db.GetLastSql(), Is.StringContaining("DisplayName".SqlColumnRaw()));
477+
Assert.That(db.GetLastSql(), Is.Not.StringContaining("IsIgnored".SqlColumnRaw()));
478478

479479
db.Insert(new TableWithIgnoredFields
480480
{

0 commit comments

Comments
 (0)