Skip to content

Commit 266f16c

Browse files
committed
Simplify TestDb ctor
1 parent 345e57e commit 266f16c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/DateTimeTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void AsStrings ()
4343
[TestCase("MMM'-'dd'-'yyyy' 'HH':'mm':'ss'.'fffffff")]
4444
public void AsCustomStrings (string format)
4545
{
46-
var db = new TestDb (false, format);
46+
var db = new TestDb (CustomDateTimeString (format));
4747
TestDateTime (db);
4848
}
4949

@@ -65,10 +65,12 @@ public void AsyncAsString ()
6565
[TestCase("MMM'-'dd'-'yyyy' 'HH':'mm':'ss'.'fffffff")]
6666
public void AsyncAsCustomStrings (string format)
6767
{
68-
var db = new SQLiteAsyncConnection (new SQLiteConnectionString (TestPath.GetTempFileName (), false, dateTimeStringFormat: format));
68+
var db = new SQLiteAsyncConnection (CustomDateTimeString (format));
6969
TestAsyncDateTime (db);
7070
}
7171

72+
SQLiteConnectionString CustomDateTimeString (string dateTimeFormat) => new SQLiteConnectionString (TestPath.GetTempFileName (), false, dateTimeFormat);
73+
7274
void TestAsyncDateTime (SQLiteAsyncConnection db)
7375
{
7476
db.CreateTableAsync<TestObj> ().Wait ();

tests/TestDb.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public TestDb (bool storeDateTimeAsTicks = true, object key = null, bool wal = t
6060
EnableWriteAheadLogging ();
6161
}
6262

63-
public TestDb (bool storeDateTimeAsTicks, string dateTimeFormat, bool wal = true) : base (new SQLiteConnectionString (TestPath.GetTempFileName (), storeDateTimeAsTicks, dateTimeStringFormat: dateTimeFormat))
63+
public TestDb (SQLiteConnectionString connectionString, bool wal = true) : base (connectionString)
6464
{
6565
Trace = true;
6666
if (wal)

0 commit comments

Comments
 (0)