Files
sql-utilities/tests/Strata.SqlTools.SqlBreakdown.Tests/SqlBreakdownCollectionTests/SqlBreakdownCollectionDropTests.cs
T
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

62 lines
1.8 KiB
C#

using Strata.SqlTools.SqlBreakdown.Classes;
namespace Strata.SqlTools.SqlBreakdown.Tests.SqlBreakdownCollectionTests;
/// <summary>
/// Unit tests for SqlBreakdownCollection with DROP statements.
/// </summary>
[TestFixture]
public class SqlBreakdownCollectionDropTests : SqlBreakdownCollectionTestBase
{
[Test]
public void ParseBatch_WithDropTableStatements_ParsesSuccessfully()
{
// Arrange
var collection = new SqlBreakdownCollection();
var batchSql = @"
DROP TABLE IF EXISTS OrderItems
GO
DROP TABLE IF EXISTS Orders
GO
DROP TABLE IF EXISTS Users
";
// Act
collection.ParseBatch(batchSql);
// Assert
Assert.That(collection, Has.Count.EqualTo(3));
Assert.Multiple(() =>
{
Assert.That(collection.GetRawStatementAt(0), Does.Contain("DROP TABLE"));
Assert.That(collection.GetRawStatementAt(1), Does.Contain("DROP TABLE"));
});
}
[Test]
public void ParseBatch_WithDropIndexAndProcedureStatements_ParsesSuccessfully()
{
// Arrange
var collection = new SqlBreakdownCollection();
var batchSql = @"
DROP INDEX IF EXISTS idx_Users_Email ON Users
GO
DROP PROCEDURE IF EXISTS sp_GetUserById
GO
DROP VIEW IF EXISTS vw_UserOrders
";
// Act
collection.ParseBatch(batchSql);
// Assert
Assert.That(collection, Has.Count.EqualTo(3));
Assert.Multiple(() =>
{
Assert.That(collection.GetRawStatementAt(0), Does.Contain("DROP INDEX"));
Assert.That(collection.GetRawStatementAt(1), Does.Contain("PROCEDURE"));
Assert.That(collection.GetRawStatementAt(2), Does.Contain("VIEW"));
});
}
}