- NUnit2046: `Assert.That(x.Count, Is.EqualTo(n))` → `Assert.That(x, Has.Count.EqualTo(n))` (or `Is.Empty` when n==0)
- NUnit2011: `Assert.That(s.Contains(x))` → `Assert.That(s, Does.Contain(x))` for richer failure messages
- CA1866: `.StartsWith("$"|"@"|":")` → `.StartsWith('$'|'@'|':')` char overload
Driven by `dotnet format analyzers --diagnostics NUnit2046 NUnit2011 CA1866`
for the cases the Roslyn fixer handles, plus a regex sweep for the remaining
`Count == n` (n>0) cases which the fixer doesn't address. CA1866 had no
associated code fix and was edited by hand (3 sites in 2 files). All tests
green (1180 passing).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using Strata.SqlTools.SqlBreakdown.Classes;
|
|
|
|
namespace Strata.SqlTools.SqlBreakdown.Tests.SqlBreakdownCollectionTests;
|
|
|
|
/// <summary>
|
|
/// Unit tests for SqlBreakdownCollection with custom separators.
|
|
/// </summary>
|
|
[TestFixture]
|
|
public class SqlBreakdownCollectionSeparatorTests : SqlBreakdownCollectionTestBase
|
|
{
|
|
[Test]
|
|
public void ParseBatch_WithSemicolonSeparator_ParsesSuccessfully()
|
|
{
|
|
// Arrange
|
|
var collection = new SqlBreakdownCollection();
|
|
var batchSql = @"
|
|
SELECT * FROM Users
|
|
;
|
|
SELECT * FROM Orders
|
|
;
|
|
SELECT * FROM Products
|
|
";
|
|
|
|
// Act
|
|
collection.ParseBatch(batchSql, ";");
|
|
|
|
// Assert
|
|
Assert.That(collection, Has.Count.EqualTo(3));
|
|
Assert.That(collection.GetRawStatementAt(0), Does.Contain("Users"));
|
|
Assert.That(collection.GetRawStatementAt(1), Does.Contain("Orders"));
|
|
Assert.That(collection.GetRawStatementAt(2), Does.Contain("Products"));
|
|
}
|
|
|
|
[Test]
|
|
public void ParseBatch_WithCustomSeparator_ParsesSuccessfully()
|
|
{
|
|
// Arrange
|
|
var collection = new SqlBreakdownCollection();
|
|
var batchSql = @"
|
|
INSERT INTO Users VALUES (1, 'John')
|
|
~~~
|
|
INSERT INTO Users VALUES (2, 'Jane')
|
|
~~~
|
|
INSERT INTO Users VALUES (3, 'Bob')
|
|
";
|
|
|
|
// Act
|
|
collection.ParseBatch(batchSql, "~~~");
|
|
|
|
// Assert
|
|
Assert.That(collection, Has.Count.EqualTo(3));
|
|
Assert.That(collection.RawStatements, Has.Count.EqualTo(3));
|
|
}
|
|
}
|