Skip to content

Commit ac96b4f

Browse files
committed
tests: Remove use of SQLiteConnectionPool
1 parent 806942d commit ac96b4f

5 files changed

Lines changed: 7 additions & 19 deletions

File tree

tests/AsyncTests.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,35 +79,28 @@ public class AsyncTests
7979
[SetUp]
8080
public void SetUp()
8181
{
82-
if (_sqliteConnectionPool != null)
83-
{
84-
_sqliteConnectionPool.Reset();
85-
}
8682
var databaseFile = TestPath.CreateTemporaryDatabase();
8783

8884
_connectionParameters = new SQLiteConnectionString(databaseFile, false);
89-
_sqliteConnectionPool = new SQLiteConnectionPool(_sqlite3Platform);
9085
}
9186

9287
private SQLiteConnectionString _connectionParameters;
9388
private SQLitePlatformTest _sqlite3Platform;
94-
private SQLiteConnectionPool _sqliteConnectionPool;
9589

9690
[TestFixtureSetUp]
9791
public void TestFixtureSetUp()
9892
{
9993
_sqlite3Platform = new SQLitePlatformTest();
100-
_sqliteConnectionPool = new SQLiteConnectionPool(_sqlite3Platform);
10194
}
10295

10396
private SQLiteAsyncConnection GetAsyncConnection()
10497
{
105-
return new SQLiteAsyncConnection(() => _sqliteConnectionPool.GetConnection(_connectionParameters));
98+
return new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(_sqlite3Platform, _connectionParameters));
10699
}
107100

108101
private SQLiteConnection GetSyncConnection()
109102
{
110-
return _sqliteConnectionPool.GetConnection(_connectionParameters);
103+
return new SQLiteConnectionWithLock(_sqlite3Platform, _connectionParameters);
111104
}
112105

113106
private Customer CreateCustomer()

tests/DateTimeOffsetTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ public void AsTicks ()
4444
[Test]
4545
public void AsyncAsTicks ()
4646
{
47-
var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest());
4847
var sqLiteConnectionString = new SQLiteConnectionString(TestPath.CreateTemporaryDatabase(), false);
49-
var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString));
48+
var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), sqLiteConnectionString));
5049
TestAsyncDateTimeOffset (db);
5150
}
5251

tests/DateTimeTest.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,16 @@ public void AsTicks()
9393
[Test]
9494
public async Task AsyncAsString()
9595
{
96-
var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest());
9796
var sqLiteConnectionString = new SQLiteConnectionString(TestPath.CreateTemporaryDatabase(), false);
98-
var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString));
97+
var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), sqLiteConnectionString));
9998
await TestAsyncDateTime(db, sqLiteConnectionString.StoreDateTimeAsTicks);
10099
}
101100

102101
[Test]
103102
public async Task AsyncAsTicks()
104103
{
105-
var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest());
106104
var sqLiteConnectionString = new SQLiteConnectionString(TestPath.CreateTemporaryDatabase(), true);
107-
var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString));
105+
var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), sqLiteConnectionString));
108106
await TestAsyncDateTime(db, sqLiteConnectionString.StoreDateTimeAsTicks);
109107
}
110108
}

tests/OpenTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ public async Task UnicodePathsAsync()
4747
var fileName = TestPath.CreateDefaultTempFilename() + UnicodeText + ".db";
4848
var filePath = TestPath.CreateTemporaryDatabase(fileName);
4949

50-
var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest());
51-
var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(new SQLiteConnectionString(filePath, true)));
50+
var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), new SQLiteConnectionString(filePath, true)));
5251
await db.CreateTableAsync<OrderLine>();
5352

5453
Assert.That(filePath.Length, Is.GreaterThan(0), fileName);

tests/TimeSpanTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ private async Task TestAsyncDateTime(SQLiteAsyncConnection db)
5151
[Test]
5252
public async Task TestTimeSpan()
5353
{
54-
var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest());
5554
var sqLiteConnectionString = new SQLiteConnectionString(TestPath.CreateTemporaryDatabase(), true);
56-
var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString));
55+
var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(new SQLitePlatformTest(), sqLiteConnectionString));
5756
await TestAsyncDateTime(db);
5857
}
5958
}

0 commit comments

Comments
 (0)