refactor(tests): migrate Database.Tests from FluentAssertions to Shouldly

Replace FluentAssertions with Shouldly across all 6 test files (94 tests).
Add ShouldlyExtensions for BeCloseTo and BeEquivalentTo patterns.
This commit is contained in:
Joseph Doherty
2026-01-29 14:40:18 -05:00
parent 04383d672c
commit 1e23616638
9 changed files with 223 additions and 152 deletions
@@ -1,8 +1,8 @@
using Dapper;
using FluentAssertions;
using JdeScoping.Core.Models.Search;
using JdeScoping.Database.Tests.Infrastructure;
using Microsoft.Data.SqlClient;
using Shouldly;
namespace JdeScoping.Database.Tests.Procedures;
@@ -26,7 +26,7 @@ public class ValidateSearchCriteriaProcedureTests : DatabaseTestBase
new { SearchId = searchId });
// Assert
await act.Should().NotThrowAsync();
await Should.NotThrowAsync(act);
}
[Fact]
@@ -38,9 +38,9 @@ public class ValidateSearchCriteriaProcedureTests : DatabaseTestBase
new { SearchId = 99999 });
// Assert
var ex = await act.Should().ThrowAsync<SqlException>();
ex.Which.Number.Should().Be(50001);
ex.Which.Message.Should().Contain("Search ID 99999 not found");
var ex = await Should.ThrowAsync<SqlException>(act);
ex.Number.ShouldBe(50001);
ex.Message.ShouldContain("Search ID 99999 not found");
}
[Fact]
@@ -55,9 +55,9 @@ public class ValidateSearchCriteriaProcedureTests : DatabaseTestBase
new { SearchId = searchId });
// Assert
var ex = await act.Should().ThrowAsync<SqlException>();
ex.Which.Number.Should().Be(50002);
ex.Which.Message.Should().Contain("has no criteria");
var ex = await Should.ThrowAsync<SqlException>(act);
ex.Number.ShouldBe(50002);
ex.Message.ShouldContain("has no criteria");
}
[Fact]
@@ -72,9 +72,9 @@ public class ValidateSearchCriteriaProcedureTests : DatabaseTestBase
new { SearchId = searchId });
// Assert
var ex = await act.Should().ThrowAsync<SqlException>();
ex.Which.Number.Should().Be(50002);
ex.Which.Message.Should().Contain("has no criteria");
var ex = await Should.ThrowAsync<SqlException>(act);
ex.Number.ShouldBe(50002);
ex.Message.ShouldContain("has no criteria");
}
[Fact]
@@ -89,9 +89,9 @@ public class ValidateSearchCriteriaProcedureTests : DatabaseTestBase
new { SearchId = searchId });
// Assert
var ex = await act.Should().ThrowAsync<SqlException>();
ex.Which.Number.Should().Be(50003);
ex.Which.Message.Should().Contain("has invalid JSON");
var ex = await Should.ThrowAsync<SqlException>(act);
ex.Number.ShouldBe(50003);
ex.Message.ShouldContain("has invalid JSON");
}
[Fact]
@@ -106,6 +106,6 @@ public class ValidateSearchCriteriaProcedureTests : DatabaseTestBase
new { SearchId = searchId });
// Assert
await act.Should().NotThrowAsync();
await Should.NotThrowAsync(act);
}
}