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:
co-authored by
Claude Opus 4.7
parent
505ada5017
commit
67512d23e1
@@ -87,9 +87,12 @@ public class QueryBreakdownCollectionTests
|
||||
// Act
|
||||
var removed = _collection.Remove(query);
|
||||
|
||||
// Assert
|
||||
Assert.That(removed, Is.True);
|
||||
Assert.That(_collection, Is.Empty);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
// Assert
|
||||
Assert.That(removed, Is.True);
|
||||
Assert.That(_collection, Is.Empty);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -103,9 +106,12 @@ public class QueryBreakdownCollectionTests
|
||||
// Act
|
||||
var removed = _collection.Remove(query2);
|
||||
|
||||
// Assert
|
||||
Assert.That(removed, Is.False);
|
||||
Assert.That(_collection, Has.Count.EqualTo(1));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
// Assert
|
||||
Assert.That(removed, Is.False);
|
||||
Assert.That(_collection, Has.Count.EqualTo(1));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -276,8 +282,11 @@ public class QueryBreakdownCollectionTests
|
||||
|
||||
// Assert
|
||||
Assert.That(summaries, Has.Count.EqualTo(2));
|
||||
Assert.That(summaries[0].HasSelectClause, Is.True);
|
||||
Assert.That(summaries[1].HasWhereClause, Is.True);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(summaries[0].HasSelectClause, Is.True);
|
||||
Assert.That(summaries[1].HasWhereClause, Is.True);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -327,9 +336,12 @@ public class QueryBreakdownCollectionTests
|
||||
// Act
|
||||
_collection.AddParameterToAll("CompanyId", 99);
|
||||
|
||||
// Assert
|
||||
Assert.That(_collection.QueryBreakdowns[0].Parameters["CompanyId"], Is.EqualTo(99));
|
||||
Assert.That(_collection.QueryBreakdowns[1].Parameters["CompanyId"], Is.EqualTo(99));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
// Assert
|
||||
Assert.That(_collection.QueryBreakdowns[0].Parameters["CompanyId"], Is.EqualTo(99));
|
||||
Assert.That(_collection.QueryBreakdowns[1].Parameters["CompanyId"], Is.EqualTo(99));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user