Skip to content

Commit 21d8bfd

Browse files
committed
Improve test assertions for date validation in integration tests
1 parent 28a364f commit 21d8bfd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

TownSuite.DapperExtras.Tests/TownSuiteDapperExtensions_IntegrationTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public async Task QueryDt_Test(Func<IDbConnection> connectionFactory)
224224
DataRow row = dt.Rows[0];
225225
Assert.That(row["Col1"], Is.EqualTo("Value1"));
226226
Assert.That(row["Col2"], Is.EqualTo("ValueA"));
227-
Assert.That(row["Col3"].ToString().StartsWith("2024-01-01"));
227+
Assert.That(row["Col3"].ToString().StartsWith("2024-01-01"), row["Col3"].ToString());
228228
}
229229

230230
[TestCaseSource(typeof(DatabaseTestCases), nameof(DatabaseTestCases.TestCases))]
@@ -242,14 +242,14 @@ public async Task QueryDt_WithSqlMapper_Test(Func<IDbConnection> connectionFacto
242242

243243
// sqlite returrns exactly what was set, postgresql and sql server are using a datetime column type and returns
244244
// extra info
245-
Assert.That(row["Col3"].ToString().StartsWith("2024-01-01"));
245+
Assert.That(row["Col3"].ToString().StartsWith("2024-01-01"), row["Col3"].ToString());
246246

247247
DataTable dt2 = await connection.QueryDtAsync("select * from exampletable where id=@Id", new { Id = id });
248248
Assert.That(dt2.Rows.Count, Is.EqualTo(1));
249249
DataRow row2 = dt2.Rows[0];
250250
Assert.That(row2["Col1"], Is.EqualTo("Value1"));
251251
Assert.That(row2["Col2"], Is.EqualTo("ValueA"));
252-
Assert.That(row2["Col3"].ToString().StartsWith("2024-01-01"));
252+
Assert.That(row2["Col3"].ToString().StartsWith("2024-01-01"), row2["Col3"].ToString());
253253
}
254254

255255
[TestCaseSource(typeof(DatabaseTestCases), nameof(DatabaseTestCases.TestCases))]
@@ -262,7 +262,7 @@ public async Task QueryDtAsync_Test(Func<IDbConnection> connectionFactory)
262262
DataRow row = dt.Rows[0];
263263
Assert.That(row["Col1"], Is.EqualTo("Value1"));
264264
Assert.That(row["Col2"], Is.EqualTo("ValueA"));
265-
Assert.That(row["Col3"].ToString().StartsWith("2024-01-01"));
265+
Assert.That(row["Col3"].ToString().StartsWith("2024-01-01"), row["Col3"].ToString());
266266
}
267267

268268
public static class DatabaseTestCases

0 commit comments

Comments
 (0)