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

Commit 366a38f

Browse files
committed
Fix remaining tests
1 parent b11ec40 commit 366a38f

File tree

3 files changed

+17
-33
lines changed

3 files changed

+17
-33
lines changed

tests/ServiceStack.OrmLite.Tests/Async/ApiMySqlTestsAsync.cs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,16 @@ namespace ServiceStack.OrmLite.Tests.Async
99
public class ApiMySqlTestsAsync
1010
: OrmLiteTestBase
1111
{
12-
private IDbConnection db;
13-
14-
[SetUp]
15-
public void SetUp()
12+
[Test]
13+
public async Task API_MySql_Examples_Async()
1614
{
15+
if (Dialect != Dialect.MySql) return;
16+
1717
SuppressIfOracle("MySql tests");
18-
db = CreateMySqlDbFactory().OpenDbConnection();
18+
var db = CreateMySqlDbFactory().OpenDbConnection();
1919
db.DropAndCreateTable<Person>();
2020
db.DropAndCreateTable<PersonWithAutoId>();
21-
}
2221

23-
[TearDown]
24-
public void TearDown()
25-
{
26-
db.Dispose();
27-
}
28-
29-
[Test]
30-
public async Task API_MySql_Examples_Async()
31-
{
3222
await db.InsertAsync(Person.Rockstars);
3323

3424
await db.SelectAsync<Person>(x => x.Age > 40);
@@ -325,6 +315,8 @@ await db.SaveAsync(new Person { Id = 12, FirstName = "Amy", LastName = "Winehous
325315

326316
await db.SaveAllAsync(new[]{ new Person { Id = 14, FirstName = "Amy", LastName = "Winehouse", Age = 27 },
327317
new Person { Id = 15, FirstName = "Amy", LastName = "Winehouse", Age = 27 } });
318+
319+
db.Dispose();
328320
}
329321
}
330322
}

tests/ServiceStack.OrmLite.Tests/Async/ApiPostgreSqlTestsAsync.cs

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,16 @@ namespace ServiceStack.OrmLite.Tests.Async
99
public class ApiPostgreSqlTestsAsync
1010
: OrmLiteTestBase
1111
{
12-
private IDbConnection db;
13-
14-
[SetUp]
15-
public void SetUp()
12+
[Test]
13+
public async Task API_PostgreSql_Examples_Async()
1614
{
17-
SuppressIfOracle("SQL Server tests");
18-
db = CreatePostgreSqlDbFactory().OpenDbConnection();
15+
if (Dialect != Dialect.PostgreSql) return;
16+
17+
SuppressIfOracle("PostgreSQL tests");
18+
var db = CreatePostgreSqlDbFactory().OpenDbConnection();
1919
db.DropAndCreateTable<Person>();
2020
db.DropAndCreateTable<PersonWithAutoId>();
21-
}
22-
23-
[TearDown]
24-
public void TearDown()
25-
{
26-
db.Dispose();
27-
}
2821

29-
[Test]
30-
public async Task API_PostgreSql_Examples_Async()
31-
{
3222
await db.InsertAsync(Person.Rockstars);
3323

3424
await db.SelectAsync<Person>(x => x.Age > 40);
@@ -324,6 +314,8 @@ await db.SaveAsync(new Person { Id = 12, FirstName = "Amy", LastName = "Winehous
324314

325315
await db.SaveAllAsync(new[]{ new Person { Id = 14, FirstName = "Amy", LastName = "Winehouse", Age = 27 },
326316
new Person { Id = 15, FirstName = "Amy", LastName = "Winehouse", Age = 27 } });
317+
318+
db.Dispose();
327319
}
328320
}
329321
}

tests/ServiceStack.OrmLite.Tests/Async/LoadReferencesTestsAsync.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class LoadReferencesTestsAsync
1515
{
1616
private IDbConnection db;
1717

18-
[OneTimeSetUp]
18+
[TestFixtureSetUp]
1919
public new void TestFixtureSetUp()
2020
{
2121
db = base.OpenDbConnection();
@@ -35,7 +35,7 @@ public void SetUp()
3535
db.DeleteAll<Customer>();
3636
}
3737

38-
[OneTimeTearDown]
38+
[TestFixtureTearDown]
3939
public void TestFixtureTearDown()
4040
{
4141
db.Dispose();

0 commit comments

Comments
 (0)