chore(sonar): wrap independent assertions in Assert.Multiple (NUnit2045)

Driven by `dotnet format analyzers --diagnostics NUnit2045`. The fixer
groups consecutive independent `Assert.That(...)` calls into
`Assert.Multiple(() => { ... })`, so a failing assertion no longer
short-circuits the block — every failure inside the group is reported,
which gives much better diagnostics on multi-property tests.

Audit confirmed no Assert.Throws / Assert.Fail / Assert.Catch / Assert.Pass
/ Assert.DoesNotThrow got pulled inside a Multiple block (those need to
short-circuit). All 1180 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thom Lamb
2026-05-27 11:59:47 -05:00
co-authored by Claude Opus 4.7
parent 505ada5017
commit 67512d23e1
47 changed files with 2132 additions and 1113 deletions
@@ -24,8 +24,11 @@ public class BooleanExpressionTests : ExpressionTestsBase
// Assert
Assert.That(firstResult, Is.Not.SameAs(BooleanExpression.False));
Assert.That(firstResult, Is.AssignableTo<BooleanExpression>());
Assert.That(secondResult, Is.Not.SameAs(BooleanExpression.False));
Assert.Multiple(() =>
{
Assert.That(firstResult, Is.AssignableTo<BooleanExpression>());
Assert.That(secondResult, Is.Not.SameAs(BooleanExpression.False));
});
Assert.That(secondResult, Is.TypeOf<AndExpression>());
}
@@ -35,11 +35,9 @@ public class GenericColumnExpressionTests : ExpressionTestsBase
Assertions = result =>
{
var results = (Dictionary<string, string>)result;
Assert.That(results["priceWithTax"], Does.Contain("Price"));
Assert.That(results["priceWithTax"], Does.Contain("1.1"));
Assert.That(results["priceWithFee"], Does.Contain("Price"));
Assert.That(results["priceWithFee"], Does.Contain("10"));
Assert.That(results["revenue"], Does.Contain("Quantity"));
Assert.That(results["priceWithTax"], Does.Contain("Price")); Assert.Multiple(() => { Assert.That(results["priceWithTax"], Does.Contain("1.1"));
Assert.That(results["priceWithFee"], Does.Contain("Price")); }); Assert.Multiple(() => { Assert.That(results["priceWithFee"], Does.Contain("10"));
Assert.That(results["revenue"], Does.Contain("Quantity")); });
Assert.That(results["revenue"], Does.Contain("Price"));
return true;
}
@@ -151,9 +149,8 @@ public class GenericColumnExpressionTests : ExpressionTestsBase
},
Assertions = result =>
{
var results = (Dictionary<string, string>)result;
Assert.That(results["customerResult"], Does.Contain("CustomerID"));
Assert.That(results["orderResult"], Does.Contain("OrderDate"));
var results = (Dictionary<string, string>)result; Assert.Multiple(() => { Assert.That(results["customerResult"], Does.Contain("CustomerID"));
Assert.That(results["orderResult"], Does.Contain("OrderDate")); });
return true;
}
},
@@ -182,9 +179,8 @@ public class GenericColumnExpressionTests : ExpressionTestsBase
Assertions = result =>
{
var results = (Dictionary<string, string>)result;
Assert.That(results["lowerBound"], Does.Contain("UnitPrice"));
Assert.That(results["lowerBound"], Does.Contain("MinPrice"));
Assert.That(results["upperBound"], Does.Contain("UnitPrice"));
Assert.That(results["lowerBound"], Does.Contain("UnitPrice")); Assert.Multiple(() => { Assert.That(results["lowerBound"], Does.Contain("MinPrice"));
Assert.That(results["upperBound"], Does.Contain("UnitPrice")); });
Assert.That(results["upperBound"], Does.Contain("MaxPrice"));
return true;
}