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
@@ -23,9 +23,12 @@ public class StatementReaderTests
|
||||
|
||||
// Assert
|
||||
Assert.That(tokens, Is.Not.Empty);
|
||||
Assert.That(tokens[0].Type, Is.EqualTo(TokenType.LeftParenthesis));
|
||||
Assert.That(tokens[1].Type, Is.EqualTo(TokenType.Number));
|
||||
Assert.That(tokens[1].Value, Is.EqualTo("1"));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(tokens[0].Type, Is.EqualTo(TokenType.LeftParenthesis));
|
||||
Assert.That(tokens[1].Type, Is.EqualTo(TokenType.Number));
|
||||
Assert.That(tokens[1].Value, Is.EqualTo("1"));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -44,10 +47,13 @@ public class StatementReaderTests
|
||||
|
||||
// Assert
|
||||
Assert.That(tokens, Has.Count.EqualTo(5)); // "COLUMN_1" + "COLUMN_2" * 2
|
||||
Assert.That(tokens[0].Type, Is.EqualTo(TokenType.ColumnIdentifier));
|
||||
Assert.That(tokens[0].Value, Is.EqualTo("COLUMN_1"));
|
||||
Assert.That(tokens[1].Type, Is.EqualTo(TokenType.Plus));
|
||||
Assert.That(tokens[2].Type, Is.EqualTo(TokenType.ColumnIdentifier));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(tokens[0].Type, Is.EqualTo(TokenType.ColumnIdentifier));
|
||||
Assert.That(tokens[0].Value, Is.EqualTo("COLUMN_1"));
|
||||
Assert.That(tokens[1].Type, Is.EqualTo(TokenType.Plus));
|
||||
Assert.That(tokens[2].Type, Is.EqualTo(TokenType.ColumnIdentifier));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -64,11 +70,14 @@ public class StatementReaderTests
|
||||
tokens.Add((sqlReader.TokenType, sqlReader.TokenValue));
|
||||
}
|
||||
|
||||
// Assert
|
||||
Assert.That(tokens[0].Type, Is.EqualTo(TokenType.ColumnIdentifier));
|
||||
Assert.That(tokens[0].Value, Is.EqualTo("MyColumn"));
|
||||
Assert.That(tokens[2].Type, Is.EqualTo(TokenType.ColumnIdentifier));
|
||||
Assert.That(tokens[2].Value, Is.EqualTo("AnotherColumn"));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
// Assert
|
||||
Assert.That(tokens[0].Type, Is.EqualTo(TokenType.ColumnIdentifier));
|
||||
Assert.That(tokens[0].Value, Is.EqualTo("MyColumn"));
|
||||
Assert.That(tokens[2].Type, Is.EqualTo(TokenType.ColumnIdentifier));
|
||||
Assert.That(tokens[2].Value, Is.EqualTo("AnotherColumn"));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -89,8 +98,11 @@ public class StatementReaderTests
|
||||
Assert.That(tokens.Count, Is.GreaterThan(0));
|
||||
var paramTokens = tokens.Where(t => t.Type == TokenType.Parameter).ToList();
|
||||
Assert.That(paramTokens, Has.Count.EqualTo(2));
|
||||
Assert.That(paramTokens[0].Value, Is.EqualTo("$1"));
|
||||
Assert.That(paramTokens[1].Value, Is.EqualTo("$2"));
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(paramTokens[0].Value, Is.EqualTo("$1"));
|
||||
Assert.That(paramTokens[1].Value, Is.EqualTo("$2"));
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user