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
@@ -62,9 +62,12 @@ public class QueryValidatorTests
|
||||
validator.Validate(breakdown2);
|
||||
var count2 = validator.Issues.Count;
|
||||
|
||||
// Assert
|
||||
Assert.That(count1, Is.GreaterThan(0));
|
||||
Assert.That(count2, Is.GreaterThan(0));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
// Assert
|
||||
Assert.That(count1, Is.GreaterThan(0));
|
||||
Assert.That(count2, Is.GreaterThan(0));
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -324,10 +327,13 @@ public class QueryValidatorTests
|
||||
var infos = validator.GetIssuesBySeverity(ValidationSeverity.Info);
|
||||
var errors = validator.GetIssuesBySeverity(ValidationSeverity.Error);
|
||||
|
||||
// Assert
|
||||
Assert.That(warnings, Is.Not.Empty);
|
||||
Assert.That(infos, Is.Not.Empty);
|
||||
Assert.That(errors, Is.Empty);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
// Assert
|
||||
Assert.That(warnings, Is.Not.Empty);
|
||||
Assert.That(infos, Is.Not.Empty);
|
||||
Assert.That(errors, Is.Empty);
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -349,8 +355,11 @@ public class QueryValidatorTests
|
||||
|
||||
// Assert
|
||||
Assert.That(validator.Issues, Has.Count.EqualTo(1));
|
||||
Assert.That(validator.Issues[0].Code, Is.EqualTo("CUSTOM_001"));
|
||||
Assert.That(validator.HasErrors, Is.True);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(validator.Issues[0].Code, Is.EqualTo("CUSTOM_001"));
|
||||
Assert.That(validator.HasErrors, Is.True);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -365,9 +374,12 @@ public class QueryValidatorTests
|
||||
.AddIssue(ValidationSeverity.Warning, "WARN_001", "Warning 1")
|
||||
.AddIssue(ValidationSeverity.Info, "INFO_001", "Info 1");
|
||||
|
||||
// Assert
|
||||
Assert.That(result, Is.SameAs(validator));
|
||||
Assert.That(validator.Issues, Has.Count.EqualTo(3));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
// Assert
|
||||
Assert.That(result, Is.SameAs(validator));
|
||||
Assert.That(validator.Issues, Has.Count.EqualTo(3));
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -480,9 +492,12 @@ public class QueryValidatorTests
|
||||
// Act
|
||||
var validator = QueryValidator.ValidateQuery(breakdown);
|
||||
|
||||
// Assert
|
||||
Assert.That(validator.Issues.Count, Is.GreaterThan(1));
|
||||
Assert.That(validator.HasWarnings, Is.True);
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
// Assert
|
||||
Assert.That(validator.Issues.Count, Is.GreaterThan(1));
|
||||
Assert.That(validator.HasWarnings, Is.True);
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user