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:
Thom Lamb
2026-05-27 11:59:47 -05:00
co-authored by Claude Opus 4.7
parent 505ada5017
commit 67512d23e1
47 changed files with 2132 additions and 1113 deletions
@@ -27,8 +27,11 @@ public class LinqQueryBreakdownTests
// Assert
Assert.That(breakdown, Is.Not.Null);
Assert.That(breakdown.EntityType, Is.EqualTo(typeof(User)));
Assert.That(breakdown.FromClause?.Clause, Does.Contain("User"));
Assert.Multiple(() =>
{
Assert.That(breakdown.EntityType, Is.EqualTo(typeof(User)));
Assert.That(breakdown.FromClause?.Clause, Does.Contain("User"));
});
}
[Test]
@@ -92,10 +95,13 @@ public class LinqQueryBreakdownTests
// Act
var breakdown = LinqQueryBreakdown.Analyze(query);
// Assert
Assert.That(breakdown.WhereClause?.Clause, Is.Not.Null);
Assert.That(breakdown.OrderByClause?.Clause, Is.Not.Null);
Assert.That(breakdown.SelectClause?.Clause, Is.Not.Null);
Assert.Multiple(() =>
{
// Assert
Assert.That(breakdown.WhereClause?.Clause, Is.Not.Null);
Assert.That(breakdown.OrderByClause?.Clause, Is.Not.Null);
Assert.That(breakdown.SelectClause?.Clause, Is.Not.Null);
});
}
[Test]
@@ -159,10 +165,13 @@ public class LinqQueryBreakdownTests
// Act
var success = LinqQueryBreakdown.TryAnalyze(query, out var breakdown, out var error);
// Assert
Assert.That(success, Is.True);
Assert.That(breakdown, Is.Not.Null);
Assert.That(error, Is.Empty);
Assert.Multiple(() =>
{
// Assert
Assert.That(success, Is.True);
Assert.That(breakdown, Is.Not.Null);
Assert.That(error, Is.Empty);
});
}
[Test]
@@ -174,9 +183,12 @@ public class LinqQueryBreakdownTests
// Act
var success = LinqQueryBreakdown.TryAnalyze(query!, out var breakdown, out var error);
// Assert
Assert.That(success, Is.False);
Assert.That(error, Is.Not.Empty);
Assert.Multiple(() =>
{
// Assert
Assert.That(success, Is.False);
Assert.That(error, Is.Not.Empty);
});
}
[Test]
@@ -194,10 +206,16 @@ public class LinqQueryBreakdownTests
// Assert
Assert.That(breakdown.SelectClause?.Clause, Does.Contain("Id"));
Assert.That(breakdown.SelectClause?.Clause, Does.Contain("Name"));
Assert.That(breakdown.SelectClause?.Clause, Does.Contain("Email"));
Assert.That(breakdown.WhereClause?.Clause, Does.Contain("Age"));
Assert.That(breakdown.WhereClause?.Clause, Does.Contain("IsActive"));
Assert.That(breakdown.OrderByClause?.Clause, Does.Contain("Name"));
Assert.Multiple(() =>
{
Assert.That(breakdown.SelectClause?.Clause, Does.Contain("Email"));
Assert.That(breakdown.WhereClause?.Clause, Does.Contain("Age"));
});
Assert.Multiple(() =>
{
Assert.That(breakdown.WhereClause?.Clause, Does.Contain("IsActive"));
Assert.That(breakdown.OrderByClause?.Clause, Does.Contain("Name"));
});
}
#region Round-Trip and Query Modification Tests
@@ -278,9 +296,12 @@ public class LinqQueryBreakdownTests
var activeSql = activeBreakdown.GetSql();
var recentSql = recentBreakdown.GetSql();
// Assert - Both queries are valid and different
Assert.That(activeSql, Does.Contain("IsActive"));
Assert.That(recentSql, Does.Contain("Age"));
Assert.Multiple(() =>
{
// Assert - Both queries are valid and different
Assert.That(activeSql, Does.Contain("IsActive"));
Assert.That(recentSql, Does.Contain("Age"));
});
Assert.That(activeSql, Is.Not.EqualTo(recentSql));
}
@@ -328,8 +349,11 @@ public class LinqQueryBreakdownTests
// Assert
Assert.That(paginatedSql, Does.Contain("ORDER BY"));
Assert.That(paginatedSql, Does.Contain("Id ASC"));
Assert.That(breakdown.SetupClauses, Has.Count.EqualTo(1));
Assert.Multiple(() =>
{
Assert.That(paginatedSql, Does.Contain("Id ASC"));
Assert.That(breakdown.SetupClauses, Has.Count.EqualTo(1));
});
}
[Test]
@@ -351,12 +375,15 @@ public class LinqQueryBreakdownTests
var hasOrdering = !string.IsNullOrEmpty(breakdown.OrderByClause?.Clause);
var summary = breakdown.GetQuerySummary();
// Assert - Verify analytics
Assert.That(methodCount, Is.GreaterThan(0));
Assert.That(hasProjection, Is.True);
Assert.That(hasFilters, Is.True);
Assert.That(hasOrdering, Is.True);
Assert.That(summary, Does.Contain("SELECT"));
Assert.Multiple(() =>
{
// Assert - Verify analytics
Assert.That(methodCount, Is.GreaterThan(0));
Assert.That(hasProjection, Is.True);
Assert.That(hasFilters, Is.True);
Assert.That(hasOrdering, Is.True);
Assert.That(summary, Does.Contain("SELECT"));
});
Assert.That(summary, Does.Contain("WHERE"));
Assert.That(summary, Does.Contain("ORDER BY"));
}
@@ -523,9 +550,12 @@ public class GetQueryTests
var linqResult = linqBreakdown.GetQuery<User>();
var sqlResult = sqlBreakdown.GetQuery<User>();
// Assert
Assert.That(linqResult, Is.Null);
Assert.That(sqlResult, Is.Null);
Assert.Multiple(() =>
{
// Assert
Assert.That(linqResult, Is.Null);
Assert.That(sqlResult, Is.Null);
});
}
#endregion
@@ -543,9 +573,12 @@ public class GetQueryTests
// Assert
Assert.That(breakdown, Is.Not.Null);
Assert.That(breakdown.TableName.Clause, Is.EqualTo("User"));
Assert.That(breakdown.InsertIntoClause.Clause, Is.Not.Empty);
Assert.That(breakdown.ValuesClause.Clause, Is.Not.Empty);
Assert.Multiple(() =>
{
Assert.That(breakdown.TableName.Clause, Is.EqualTo("User"));
Assert.That(breakdown.InsertIntoClause.Clause, Is.Not.Empty);
Assert.That(breakdown.ValuesClause.Clause, Is.Not.Empty);
});
Assert.That(breakdown.InsertIntoClause.Clause, Does.Contain("Id"));
Assert.That(breakdown.InsertIntoClause.Clause, Does.Contain("Name"));
}
@@ -565,9 +598,12 @@ public class GetQueryTests
// Assert
Assert.That(breakdown, Is.Not.Null);
Assert.That(breakdown.TableName.Clause, Is.EqualTo("User"));
Assert.That(breakdown.InsertIntoClause.Clause, Is.Not.Empty);
Assert.That(breakdown.ValuesClause.Clause, Does.Contain("("));
Assert.Multiple(() =>
{
Assert.That(breakdown.TableName.Clause, Is.EqualTo("User"));
Assert.That(breakdown.InsertIntoClause.Clause, Is.Not.Empty);
Assert.That(breakdown.ValuesClause.Clause, Does.Contain("("));
});
}
[Test]
@@ -690,8 +726,11 @@ public class GetQueryTests
// Assert
Assert.That(breakdown, Is.Not.Null);
Assert.That(breakdown.ProcedureName.Clause, Is.EqualTo(procName));
Assert.That(breakdown.Parameters, Is.Not.Empty);
Assert.Multiple(() =>
{
Assert.That(breakdown.ProcedureName.Clause, Is.EqualTo(procName));
Assert.That(breakdown.Parameters, Is.Not.Empty);
});
Assert.That(breakdown.Parameters, Has.Count.EqualTo(2));
}
@@ -763,10 +802,13 @@ public class GetQueryTests
// Assert
Assert.That(sqlServerBreakdown, Is.Not.Null);
Assert.That(sqlServerBreakdown.SelectClause?.Clause, Is.EqualTo(breakdown.SelectClause?.Clause));
Assert.That(sqlServerBreakdown.FromClause?.Clause, Is.EqualTo(breakdown.FromClause?.Clause));
Assert.That(sqlServerBreakdown.WhereClause?.Clause, Is.EqualTo(breakdown.WhereClause?.Clause));
Assert.That(sqlServerBreakdown.OrderByClause?.Clause, Is.EqualTo(breakdown.OrderByClause?.Clause));
Assert.Multiple(() =>
{
Assert.That(sqlServerBreakdown.SelectClause?.Clause, Is.EqualTo(breakdown.SelectClause?.Clause));
Assert.That(sqlServerBreakdown.FromClause?.Clause, Is.EqualTo(breakdown.FromClause?.Clause));
Assert.That(sqlServerBreakdown.WhereClause?.Clause, Is.EqualTo(breakdown.WhereClause?.Clause));
Assert.That(sqlServerBreakdown.OrderByClause?.Clause, Is.EqualTo(breakdown.OrderByClause?.Clause));
});
}
[Test]
@@ -784,10 +826,13 @@ public class GetQueryTests
// Assert
Assert.That(postgresBreakdown, Is.Not.Null);
Assert.That(postgresBreakdown.SelectClause?.Clause, Is.EqualTo(breakdown.SelectClause?.Clause));
Assert.That(postgresBreakdown.FromClause?.Clause, Is.EqualTo(breakdown.FromClause?.Clause));
Assert.That(postgresBreakdown.WhereClause?.Clause, Is.EqualTo(breakdown.WhereClause?.Clause));
Assert.That(postgresBreakdown.OrderByClause?.Clause, Is.EqualTo(breakdown.OrderByClause?.Clause));
Assert.Multiple(() =>
{
Assert.That(postgresBreakdown.SelectClause?.Clause, Is.EqualTo(breakdown.SelectClause?.Clause));
Assert.That(postgresBreakdown.FromClause?.Clause, Is.EqualTo(breakdown.FromClause?.Clause));
Assert.That(postgresBreakdown.WhereClause?.Clause, Is.EqualTo(breakdown.WhereClause?.Clause));
Assert.That(postgresBreakdown.OrderByClause?.Clause, Is.EqualTo(breakdown.OrderByClause?.Clause));
});
}
[Test]
@@ -802,10 +847,13 @@ public class GetQueryTests
// Assert
Assert.That(snowflakeBreakdown, Is.Not.Null);
Assert.That(snowflakeBreakdown.SelectClause?.Clause, Is.EqualTo(breakdown.SelectClause?.Clause));
Assert.That(snowflakeBreakdown.FromClause?.Clause, Is.EqualTo(breakdown.FromClause?.Clause));
Assert.That(snowflakeBreakdown.WhereClause?.Clause, Is.EqualTo(breakdown.WhereClause?.Clause));
Assert.That(snowflakeBreakdown.OrderByClause?.Clause, Is.EqualTo(breakdown.OrderByClause?.Clause));
Assert.Multiple(() =>
{
Assert.That(snowflakeBreakdown.SelectClause?.Clause, Is.EqualTo(breakdown.SelectClause?.Clause));
Assert.That(snowflakeBreakdown.FromClause?.Clause, Is.EqualTo(breakdown.FromClause?.Clause));
Assert.That(snowflakeBreakdown.WhereClause?.Clause, Is.EqualTo(breakdown.WhereClause?.Clause));
Assert.That(snowflakeBreakdown.OrderByClause?.Clause, Is.EqualTo(breakdown.OrderByClause?.Clause));
});
}
[Test]
@@ -819,9 +867,12 @@ public class GetQueryTests
// Act
var sqlServerBreakdown = breakdown.ConvertToSqlServerBreakdown();
// Assert
Assert.That(sqlServerBreakdown.SelectClause?.Comment, Is.EqualTo("Select user columns"));
Assert.That(sqlServerBreakdown.WhereClause?.Comment, Is.EqualTo("Filter adult users"));
Assert.Multiple(() =>
{
// Assert
Assert.That(sqlServerBreakdown.SelectClause?.Comment, Is.EqualTo("Select user columns"));
Assert.That(sqlServerBreakdown.WhereClause?.Comment, Is.EqualTo("Filter adult users"));
});
}
[Test]
@@ -837,12 +888,15 @@ public class GetQueryTests
// Act
var postgresBreakdown = breakdown.ConvertToPostgreSqlBreakdown();
// Assert
Assert.That(postgresBreakdown.SelectClause?.Clause, Is.Not.Null);
Assert.That(postgresBreakdown.FromClause?.Clause, Is.Not.Null);
Assert.That(postgresBreakdown.WhereClause?.Clause, Is.Not.Null);
Assert.That(postgresBreakdown.GroupByClause?.Clause, Is.Not.Null);
Assert.That(postgresBreakdown.OrderByClause?.Clause, Is.Not.Null);
Assert.Multiple(() =>
{
// Assert
Assert.That(postgresBreakdown.SelectClause?.Clause, Is.Not.Null);
Assert.That(postgresBreakdown.FromClause?.Clause, Is.Not.Null);
Assert.That(postgresBreakdown.WhereClause?.Clause, Is.Not.Null);
Assert.That(postgresBreakdown.GroupByClause?.Clause, Is.Not.Null);
Assert.That(postgresBreakdown.OrderByClause?.Clause, Is.Not.Null);
});
}
[Test]
@@ -854,9 +908,12 @@ public class GetQueryTests
// Act
var snowflakeBreakdown = breakdown.ConvertToSnowflakeBreakdown();
// Assert
Assert.That(snowflakeBreakdown.FromClause?.Clause, Is.EqualTo(breakdown.FromClause?.Clause));
Assert.That(snowflakeBreakdown.OrderByClause?.Clause, Is.EqualTo(breakdown.OrderByClause?.Clause));
Assert.Multiple(() =>
{
// Assert
Assert.That(snowflakeBreakdown.FromClause?.Clause, Is.EqualTo(breakdown.FromClause?.Clause));
Assert.That(snowflakeBreakdown.OrderByClause?.Clause, Is.EqualTo(breakdown.OrderByClause?.Clause));
});
}
[Test]