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

Commit 46b2af5

Browse files
committed
remove unused files and refactor lost RestrictionTests
1 parent 1272413 commit 46b2af5

File tree

6 files changed

+100
-301
lines changed

6 files changed

+100
-301
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
using NUnit.Framework;
2+
3+
namespace ServiceStack.OrmLite.Tests.Expression
4+
{
5+
[TestFixture]
6+
public class ExpressionTests : OrmLiteTestBase
7+
{
8+
public class Person
9+
{
10+
public Person() {}
11+
12+
public Person(int id, string firstName, string lastName, int age)
13+
{
14+
Id = id;
15+
FirstName = firstName;
16+
LastName = lastName;
17+
Age = age;
18+
}
19+
20+
public int Id { get; set; }
21+
public string FirstName { get; set; }
22+
public string LastName { get; set; }
23+
public int? Age { get; set; }
24+
}
25+
26+
public Person[] People = {
27+
new Person(1, "Jimi", "Hendrix", 27),
28+
new Person(2, "Janis", "Joplin", 27),
29+
new Person(3, "Jim", "Morrisson", 27),
30+
new Person(4, "Kurt", "Cobain", 27),
31+
new Person(5, "Elvis", "Presley", 42),
32+
new Person(6, "Michael", "Jackson", 50),
33+
};
34+
35+
[Test]
36+
public void Can_Chain_Expressions_Using_Or_and_And()
37+
{
38+
using (var db = OpenDbConnection())
39+
{
40+
db.DropAndCreateTable<Person>();
41+
db.InsertAll(People);
42+
43+
var q = db.From<Person>();
44+
45+
q.Where(x => x.FirstName.StartsWith("Jim")).Or(x => x.LastName.StartsWith("Cob"));
46+
47+
var results = db.Select(q);
48+
Assert.AreEqual(3, results.Count);
49+
50+
q.Where(); //clear where expression
51+
52+
q.Where(x => x.FirstName.StartsWith("Jim")).And(x => x.LastName.StartsWith("Hen"));
53+
results = db.Select(q);
54+
55+
Assert.AreEqual(1, results.Count);
56+
}
57+
}
58+
59+
[Test]
60+
public void Can_get_rowcount_from_expression_visitor()
61+
{
62+
using (var db = OpenDbConnection())
63+
{
64+
db.DropAndCreateTable<Person>();
65+
db.InsertAll(People);
66+
67+
var q = db.From<Person>();
68+
69+
q.Where(x => x.FirstName.StartsWith("Jim")).Or(x => x.LastName.StartsWith("Cob"));
70+
71+
var count = db.Count(q);
72+
73+
var results = db.Select(q);
74+
Assert.AreEqual(count, results.Count);
75+
}
76+
}
77+
}
78+
}

tests/ServiceStack.OrmLite.Tests/Expressions/RestrictionTests.cs

Lines changed: 0 additions & 98 deletions
This file was deleted.

tests/ServiceStack.OrmLite.Tests/OrmLiteInsertImageBlobTests.cs

Lines changed: 0 additions & 126 deletions
This file was deleted.

tests/ServiceStack.OrmLite.Tests/Properties/Settings.Designer.cs

Lines changed: 0 additions & 37 deletions
This file was deleted.

tests/ServiceStack.OrmLite.Tests/Properties/Settings.settings

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)