Files
sql-utilities/tests/Strata.SqlTools.SqlServer.Tests/SqlServer/StatementReaderTests.cs
Thom LambandClaude Opus 4.7 67512d23e1 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>
2026-05-27 11:59:47 -05:00

33 lines
990 B
C#

using Strata.SqlTools.SqlBreakdown.Enums.SQL;
using Strata.SqlTools.Statements.SqlServer;
namespace Strata.SqlTools.SqlBreakdown.Tests.SqlServer;
[TestFixture]
public class StatementReaderTests
{
[Test]
public void StatementReader_ParsesCalculationString()
{
// Arrange
var calculationString = "(1 + 2) / sum([586883]) + sum([586664]) - sum([586664_1]) * 2.3";
var sqlReader = new StatementReader(calculationString);
var tokens = new List<(TokenType Type, string Value)>();
// Act
while (sqlReader.Read())
{
tokens.Add((sqlReader.TokenType, sqlReader.TokenValue));
}
// Assert
Assert.That(tokens, Is.Not.Empty);
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"));
});
}
}