chore(sonar): adopt Has.Count, Is.Empty, Does.Contain, char overloads in tests (NUnit2046, NUnit2011, CA1866)
- 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>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
5aca8e93fd
commit
505ada5017
@@ -692,7 +692,7 @@ public class GetQueryTests
|
||||
Assert.That(breakdown, Is.Not.Null);
|
||||
Assert.That(breakdown.ProcedureName.Clause, Is.EqualTo(procName));
|
||||
Assert.That(breakdown.Parameters, Is.Not.Empty);
|
||||
Assert.That(breakdown.Parameters.Count, Is.EqualTo(2));
|
||||
Assert.That(breakdown.Parameters, Has.Count.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -22,7 +22,7 @@ public class QueryCollectionAnalyzerTests
|
||||
// Assert
|
||||
Assert.That(stats.TotalQueries, Is.EqualTo(0));
|
||||
Assert.That(stats.UniqueQueries, Is.EqualTo(0));
|
||||
Assert.That(stats.DuplicateQueries.Count, Is.EqualTo(0));
|
||||
Assert.That(stats.DuplicateQueries, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -46,7 +46,7 @@ public class QueryCollectionAnalyzerTests
|
||||
// Assert
|
||||
Assert.That(stats.TotalQueries, Is.EqualTo(1));
|
||||
Assert.That(stats.UniqueQueries, Is.EqualTo(1));
|
||||
Assert.That(stats.DuplicateQueries.Count, Is.EqualTo(0));
|
||||
Assert.That(stats.DuplicateQueries, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -80,7 +80,7 @@ public class QueryCollectionAnalyzerTests
|
||||
// Assert
|
||||
Assert.That(stats.TotalQueries, Is.EqualTo(3));
|
||||
Assert.That(stats.UniqueQueries, Is.EqualTo(1));
|
||||
Assert.That(stats.DuplicateQueries.Count, Is.EqualTo(2));
|
||||
Assert.That(stats.DuplicateQueries, Has.Count.EqualTo(2));
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -345,7 +345,7 @@ public class QueryCollectionAnalyzerTests
|
||||
var duplicates = analyzer.FindDuplicates();
|
||||
|
||||
// Assert
|
||||
Assert.That(duplicates.Count, Is.EqualTo(0));
|
||||
Assert.That(duplicates, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -365,7 +365,7 @@ public class QueryCollectionAnalyzerTests
|
||||
var duplicates = analyzer.FindDuplicates();
|
||||
|
||||
// Assert
|
||||
Assert.That(duplicates.Count, Is.EqualTo(2));
|
||||
Assert.That(duplicates, Has.Count.EqualTo(2));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -348,7 +348,7 @@ public class QueryValidatorTests
|
||||
"This is a custom issue");
|
||||
|
||||
// Assert
|
||||
Assert.That(validator.Issues.Count, Is.EqualTo(1));
|
||||
Assert.That(validator.Issues, Has.Count.EqualTo(1));
|
||||
Assert.That(validator.Issues[0].Code, Is.EqualTo("CUSTOM_001"));
|
||||
Assert.That(validator.HasErrors, Is.True);
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public class QueryValidatorTests
|
||||
|
||||
// Assert
|
||||
Assert.That(result, Is.SameAs(validator));
|
||||
Assert.That(validator.Issues.Count, Is.EqualTo(3));
|
||||
Assert.That(validator.Issues, Has.Count.EqualTo(3));
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -386,7 +386,7 @@ public class QueryValidatorTests
|
||||
validator.Clear();
|
||||
|
||||
// Assert
|
||||
Assert.That(validator.Issues.Count, Is.EqualTo(0));
|
||||
Assert.That(validator.Issues, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -22,7 +22,7 @@ public class QueryBreakdownCollectionTests
|
||||
var collection = new QueryBreakdownCollection();
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(0));
|
||||
Assert.That(collection, Is.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -56,7 +56,7 @@ public class QueryBreakdownCollectionTests
|
||||
_collection.Add(query3);
|
||||
|
||||
// Assert
|
||||
Assert.That(_collection.Count, Is.EqualTo(3));
|
||||
Assert.That(_collection, Has.Count.EqualTo(3));
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -285,7 +285,7 @@ public class QueryBreakdownCollectionTests
|
||||
// Assert
|
||||
Assert.That(sql, Does.Contain("SELECT"));
|
||||
Assert.That(sql, Does.Contain(";"));
|
||||
Assert.That(_collection.Count, Is.EqualTo(3));
|
||||
Assert.That(_collection, Has.Count.EqualTo(3));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -175,7 +175,7 @@ public class RecursiveCTETests
|
||||
|
||||
// Assert
|
||||
// PostgreSQL stores parameters with positional syntax
|
||||
var statusKey = merged.Keys.FirstOrDefault(k => k.Contains("Status") && !k.StartsWith("$"));
|
||||
var statusKey = merged.Keys.FirstOrDefault(k => k.Contains("Status") && !k.StartsWith('$'));
|
||||
Assert.That(statusKey, Is.Not.Null);
|
||||
Assert.That(merged[statusKey], Is.EqualTo("active"), "Main query parameter should take precedence");
|
||||
}
|
||||
@@ -247,8 +247,8 @@ public class RecursiveCTETests
|
||||
|
||||
// Assert
|
||||
Assert.That(sql, Contains.Substring("WITH RECURSIVE"));
|
||||
Assert.That(sql.Contains("base AS"), "Non-recursive CTE should be included");
|
||||
Assert.That(sql.Contains("tree_hierarchy AS"), "Recursive CTE should be included");
|
||||
Assert.That(sql, Does.Contain("base AS"), "Non-recursive CTE should be included");
|
||||
Assert.That(sql, Does.Contain("tree_hierarchy AS"), "Recursive CTE should be included");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -88,7 +88,7 @@ public class StatementReaderTests
|
||||
// Assert
|
||||
Assert.That(tokens.Count, Is.GreaterThan(0));
|
||||
var paramTokens = tokens.Where(t => t.Type == TokenType.Parameter).ToList();
|
||||
Assert.That(paramTokens.Count, Is.EqualTo(2));
|
||||
Assert.That(paramTokens, Has.Count.EqualTo(2));
|
||||
Assert.That(paramTokens[0].Value, Is.EqualTo("$1"));
|
||||
Assert.That(paramTokens[1].Value, Is.EqualTo("$2"));
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class QueryBreakdownCollectionTests
|
||||
public void Constructor_Empty_CreatesEmptyCollection()
|
||||
{
|
||||
// Act & Assert
|
||||
Assert.That(_collection.Count, Is.EqualTo(0));
|
||||
Assert.That(_collection, Is.Empty);
|
||||
Assert.That(_collection.QueryBreakdowns, Is.Empty);
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ public class QueryBreakdownCollectionTests
|
||||
var collection = new QueryBreakdownCollection(queries);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection.QueryBreakdowns.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.QueryBreakdowns, Has.Count.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -49,7 +49,7 @@ public class QueryBreakdownCollectionTests
|
||||
_collection.Add(query);
|
||||
|
||||
// Assert
|
||||
Assert.That(_collection.Count, Is.EqualTo(1));
|
||||
Assert.That(_collection, Has.Count.EqualTo(1));
|
||||
Assert.That(_collection.QueryBreakdowns[0], Is.EqualTo(query));
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class QueryBreakdownCollectionTests
|
||||
var results = _collection.WhereUseStageReference().ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(results.Count, Is.EqualTo(1));
|
||||
Assert.That(results, Has.Count.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -121,7 +121,7 @@ public class QueryBreakdownCollectionTests
|
||||
|
||||
// Assert
|
||||
// Only the stage reference query should be returned, not the parameter query
|
||||
Assert.That(results.Count, Is.EqualTo(1));
|
||||
Assert.That(results, Has.Count.EqualTo(1));
|
||||
Assert.That(results[0], Is.EqualTo(queryWithStage));
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class QueryBreakdownCollectionTests
|
||||
var results = _collection.WhereUseSemiStructuredData().ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(results.Count, Is.EqualTo(1));
|
||||
Assert.That(results, Has.Count.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -168,7 +168,7 @@ public class QueryBreakdownCollectionTests
|
||||
var tables = _collection.GetUniqueTableReferences().ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(tables.Count, Is.EqualTo(2));
|
||||
Assert.That(tables, Has.Count.EqualTo(2));
|
||||
Assert.That(tables, Does.Contain("Users"));
|
||||
Assert.That(tables, Does.Contain("Orders"));
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public class QueryBreakdownCollectionTests
|
||||
var summaries = _collection.GetQuerySummaries().ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(summaries.Count, Is.EqualTo(2));
|
||||
Assert.That(summaries, Has.Count.EqualTo(2));
|
||||
Assert.That(summaries[0].UsesSemiStructuredData, Is.True);
|
||||
Assert.That(summaries[1].UsesStageReference, Is.True);
|
||||
}
|
||||
@@ -273,6 +273,6 @@ public class QueryBreakdownCollectionTests
|
||||
_collection.Clear();
|
||||
|
||||
// Assert
|
||||
Assert.That(_collection.Count, Is.EqualTo(0));
|
||||
Assert.That(_collection, Is.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ public class QueryBreakdownTests
|
||||
mainQueryBreakdown.AddWithClause("PRODUCT_ORDERS", cteSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(mainQueryBreakdown.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(mainQueryBreakdown.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(mainQueryBreakdown.WithClauses[0].TableName, Is.EqualTo("PRODUCT_ORDERS"));
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public class QueryBreakdownTests
|
||||
mainQueryBreakdown.AddWithClause("ProductOrders", cteSql, isMicrosoftSql: true);
|
||||
|
||||
// Assert
|
||||
Assert.That(mainQueryBreakdown.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(mainQueryBreakdown.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(mainQueryBreakdown.WithClauses[0].TableName, Is.EqualTo("ProductOrders"));
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public class QueryBreakdownTests
|
||||
mainQueryBreakdown.AddWithClause("PRODUCT_ORDERS", cteQuery);
|
||||
|
||||
// Assert
|
||||
Assert.That(mainQueryBreakdown.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(mainQueryBreakdown.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(mainQueryBreakdown.WithClauses[0].Query, Is.EqualTo(cteQuery));
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ public class QueryBreakdownTests
|
||||
|
||||
// Assert - Now using WITH clause
|
||||
Assert.That(query.IsUsingWithClause, Is.True);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(1));
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -688,7 +688,7 @@ public class QueryBreakdownTests
|
||||
queryBreakdown.AddWithClause("ORDER_CTE", cte);
|
||||
|
||||
// Assert
|
||||
Assert.That(queryBreakdown.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(queryBreakdown.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(queryBreakdown.IsUsingWithClause, Is.True);
|
||||
}
|
||||
|
||||
@@ -763,7 +763,7 @@ public class QueryBreakdownTests
|
||||
// Assert
|
||||
Assert.That(sql, Does.Contain("WITH"));
|
||||
Assert.That(sql, Does.Contain("MIDDLE_CTE AS ("));
|
||||
Assert.That(mainQueryBreakdown.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(mainQueryBreakdown.WithClauses, Has.Count.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1511,7 +1511,7 @@ public class QueryBreakdownTests
|
||||
var snowflakeSql = result.GetSql();
|
||||
|
||||
// Assert
|
||||
Assert.That(result.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(result.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(snowflakeSql, Does.Contain("WITH"));
|
||||
Assert.That(snowflakeSql, Does.Contain("ProductSummary AS ("));
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ public class RecursiveCTETests
|
||||
|
||||
// Assert
|
||||
// Snowflake stores parameters with both @ and : formats
|
||||
var statusKey = merged.Keys.FirstOrDefault(k => k.Contains("Status") && (k.StartsWith("@") || k.StartsWith(":")));
|
||||
var statusKey = merged.Keys.FirstOrDefault(k => k.Contains("Status") && (k.StartsWith('@') || k.StartsWith(':')));
|
||||
Assert.That(statusKey, Is.Not.Null);
|
||||
Assert.That(merged[statusKey], Is.EqualTo("active"), "Main query parameter should take precedence");
|
||||
}
|
||||
@@ -247,8 +247,8 @@ public class RecursiveCTETests
|
||||
|
||||
// Assert
|
||||
Assert.That(sql, Contains.Substring("WITH RECURSIVE"));
|
||||
Assert.That(sql.Contains("base AS"), "Non-recursive CTE should be included");
|
||||
Assert.That(sql.Contains("tree_hierarchy AS"), "Recursive CTE should be included");
|
||||
Assert.That(sql, Does.Contain("base AS"), "Non-recursive CTE should be included");
|
||||
Assert.That(sql, Does.Contain("tree_hierarchy AS"), "Recursive CTE should be included");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -389,7 +389,7 @@ public class ExceptionHandlingTests
|
||||
query.AddWithClause("active_users", cteQuery);
|
||||
|
||||
// Assert
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(query.WithClauses[0].TableName, Is.EqualTo("active_users"));
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -188,7 +188,7 @@ public class QueryBreakdownExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.That(query.IsUsingWithClause, Is.True);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(query.WithClauses[0].TableName, Is.EqualTo("active_users"));
|
||||
Assert.That(query.SelectClause.Clause, Is.EqualTo("*"));
|
||||
Assert.That(query.FromClause.Clause, Is.EqualTo("active_users"));
|
||||
@@ -238,7 +238,7 @@ public class QueryBreakdownExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.That(query.IsUsingWithClause, Is.True);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(2));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(2));
|
||||
Assert.That(query.WithClauses[0].TableName, Is.EqualTo("active_users"));
|
||||
Assert.That(query.WithClauses[1].TableName, Is.EqualTo("recent_orders"));
|
||||
}
|
||||
@@ -261,7 +261,7 @@ public class QueryBreakdownExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.That(query.IsUsingWithClause, Is.True);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(sql, Does.Contain("active_users (id, name, email)"));
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ public class QueryBreakdownExtensionsTests
|
||||
|
||||
// Assert
|
||||
Assert.That(query.IsUsingWithClause, Is.True);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(query.WithClauses[0].TableName, Is.EqualTo("active_users"));
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ public class QueryBreakdownExtensionsTests
|
||||
var sql = query.GetSql();
|
||||
|
||||
// Assert
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(2));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(2));
|
||||
Assert.That(sql, Does.Contain("active_users AS"));
|
||||
Assert.That(sql, Does.Contain("user_orders AS"));
|
||||
Assert.That(sql, Does.Contain("customer_tier"));
|
||||
|
||||
+13
-13
@@ -16,7 +16,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
var collection = new SqlBreakdownCollection();
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(0));
|
||||
Assert.That(collection, Is.Empty);
|
||||
Assert.That(collection.IsEmpty, Is.True);
|
||||
Assert.That(collection.Breakdowns, Is.Empty);
|
||||
Assert.That(collection.RawStatements, Is.Empty);
|
||||
@@ -36,7 +36,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
var collection = new SqlBreakdownCollection(mockBreakdowns);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.IsEmpty, Is.False);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
collection.Add(breakdown);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(1));
|
||||
Assert.That(collection, Has.Count.EqualTo(1));
|
||||
Assert.That(collection.GetAt(0), Is.EqualTo(breakdown));
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
collection.AddRange(breakdowns);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(3));
|
||||
Assert.That(collection, Has.Count.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -106,7 +106,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
|
||||
// Assert
|
||||
Assert.That(result, Is.True);
|
||||
Assert.That(collection.Count, Is.EqualTo(0));
|
||||
Assert.That(collection, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -121,7 +121,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
|
||||
// Assert
|
||||
Assert.That(result, Is.False);
|
||||
Assert.That(collection.Count, Is.EqualTo(1));
|
||||
Assert.That(collection, Has.Count.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -138,7 +138,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
collection.Clear();
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(0));
|
||||
Assert.That(collection, Is.Empty);
|
||||
Assert.That(collection.IsEmpty, Is.True);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.RawStatements.Count, Is.EqualTo(3));
|
||||
Assert.That(collection.RawStatements, Has.Count.EqualTo(3));
|
||||
Assert.That(collection.RawStatements[0], Does.Contain("Table1"));
|
||||
Assert.That(collection.RawStatements[1], Does.Contain("Table2"));
|
||||
Assert.That(collection.RawStatements[2], Does.Contain("Table3"));
|
||||
@@ -182,7 +182,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.RawStatements.Count, Is.EqualTo(3));
|
||||
Assert.That(collection.RawStatements, Has.Count.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -202,7 +202,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.RawStatements.Count, Is.EqualTo(3));
|
||||
Assert.That(collection.RawStatements, Has.Count.EqualTo(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -222,7 +222,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.RawStatements.Count, Is.EqualTo(2));
|
||||
Assert.That(collection.RawStatements, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.RawStatements[0], Does.Contain("Table1"));
|
||||
Assert.That(collection.RawStatements[1], Does.Contain("Table2"));
|
||||
}
|
||||
@@ -338,7 +338,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
var filtered = collection.Where(b => b.ToString()!.Contains("Table2")).ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(filtered.Count, Is.EqualTo(1));
|
||||
Assert.That(filtered, Has.Count.EqualTo(1));
|
||||
Assert.That(filtered[0].ToString()!, Does.Contain("Table2"));
|
||||
}
|
||||
|
||||
@@ -357,7 +357,7 @@ public class SqlBreakdownCollectionCoreTests : SqlBreakdownCollectionTestBase
|
||||
var projected = collection.Select(b => b.ToString()!.Length).ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(projected.Count, Is.EqualTo(2));
|
||||
Assert.That(projected, Has.Count.EqualTo(2));
|
||||
Assert.That(projected[0], Is.GreaterThan(0));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ public class SqlBreakdownCollectionCreateTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("CREATE TABLE Users"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("CREATE TABLE Orders"));
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class SqlBreakdownCollectionCreateTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("CREATE INDEX"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("UNIQUE"));
|
||||
}
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ public class SqlBreakdownCollectionDeleteTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(3));
|
||||
Assert.That(collection, Has.Count.EqualTo(3));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("DELETE FROM Orders"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("NOT IN"));
|
||||
Assert.That(collection.GetRawStatementAt(2), Does.Contain("DATEADD"));
|
||||
@@ -48,7 +48,7 @@ public class SqlBreakdownCollectionDeleteTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("EXISTS"));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ public class SqlBreakdownCollectionDropTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(3));
|
||||
Assert.That(collection, Has.Count.EqualTo(3));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("DROP TABLE"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("DROP TABLE"));
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class SqlBreakdownCollectionDropTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(3));
|
||||
Assert.That(collection, Has.Count.EqualTo(3));
|
||||
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"));
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ public class SqlBreakdownCollectionInsertTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(3));
|
||||
Assert.That(collection, Has.Count.EqualTo(3));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("INSERT INTO Users"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("Jane Smith"));
|
||||
Assert.That(collection.GetRawStatementAt(2), Does.Contain("Bob Johnson"));
|
||||
@@ -48,7 +48,7 @@ public class SqlBreakdownCollectionInsertTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("INSERT INTO UsersArchive"));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("SELECT"));
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class SqlBreakdownCollectionInsertTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("BULK INSERT"));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -37,7 +37,7 @@ public class SqlBreakdownCollectionMixedCrudTests : SqlBreakdownCollectionTestBa
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(7));
|
||||
Assert.That(collection, Has.Count.EqualTo(7));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("CREATE TABLE"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("INSERT"));
|
||||
Assert.That(collection.GetRawStatementAt(3), Does.Contain("SELECT"));
|
||||
@@ -81,8 +81,8 @@ public class SqlBreakdownCollectionMixedCrudTests : SqlBreakdownCollectionTestBa
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(5));
|
||||
Assert.That(collection.RawStatements.Count, Is.EqualTo(5));
|
||||
Assert.That(collection, Has.Count.EqualTo(5));
|
||||
Assert.That(collection.RawStatements, Has.Count.EqualTo(5));
|
||||
foreach (var statement in collection.RawStatements)
|
||||
{
|
||||
Assert.That(statement, Is.Not.Empty);
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ public class SqlBreakdownCollectionParameterTests : SqlBreakdownCollectionTestBa
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("@UserId"));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("@UserEmail"));
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class SqlBreakdownCollectionParameterTests : SqlBreakdownCollectionTestBa
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("@Name"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("@Status"));
|
||||
}
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ public class SqlBreakdownCollectionSelectTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("LEFT JOIN"));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("GROUP BY"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("BETWEEN"));
|
||||
@@ -79,7 +79,7 @@ public class SqlBreakdownCollectionSelectTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("JOIN"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("IN"));
|
||||
}
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ public class SqlBreakdownCollectionSeparatorTests : SqlBreakdownCollectionTestBa
|
||||
collection.ParseBatch(batchSql, ";");
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(3));
|
||||
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"));
|
||||
@@ -48,7 +48,7 @@ public class SqlBreakdownCollectionSeparatorTests : SqlBreakdownCollectionTestBa
|
||||
collection.ParseBatch(batchSql, "~~~");
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(3));
|
||||
Assert.That(collection.RawStatements.Count, Is.EqualTo(3));
|
||||
Assert.That(collection, Has.Count.EqualTo(3));
|
||||
Assert.That(collection.RawStatements, Has.Count.EqualTo(3));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -25,7 +25,7 @@ public class SqlBreakdownCollectionUpdateTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(3));
|
||||
Assert.That(collection, Has.Count.EqualTo(3));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("UPDATE Users"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("Status"));
|
||||
Assert.That(collection.GetRawStatementAt(2), Does.Contain("Price * 1.1"));
|
||||
@@ -52,7 +52,7 @@ public class SqlBreakdownCollectionUpdateTests : SqlBreakdownCollectionTestBase
|
||||
collection.ParseBatch(batchSql);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.GetRawStatementAt(0), Does.Contain("UPDATE u"));
|
||||
Assert.That(collection.GetRawStatementAt(1), Does.Contain("Quantity - 1"));
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ public class QueryBreakdownCollectionTests
|
||||
public void Constructor_Empty_CreatesEmptyCollection()
|
||||
{
|
||||
// Act & Assert
|
||||
Assert.That(_collection.Count, Is.EqualTo(0));
|
||||
Assert.That(_collection, Is.Empty);
|
||||
Assert.That(_collection.QueryBreakdowns, Is.Empty);
|
||||
}
|
||||
|
||||
@@ -35,8 +35,8 @@ public class QueryBreakdownCollectionTests
|
||||
var collection = new QueryBreakdownCollection(queries);
|
||||
|
||||
// Assert
|
||||
Assert.That(collection.Count, Is.EqualTo(2));
|
||||
Assert.That(collection.QueryBreakdowns.Count, Is.EqualTo(2));
|
||||
Assert.That(collection, Has.Count.EqualTo(2));
|
||||
Assert.That(collection.QueryBreakdowns, Has.Count.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -49,7 +49,7 @@ public class QueryBreakdownCollectionTests
|
||||
_collection.Add(query);
|
||||
|
||||
// Assert
|
||||
Assert.That(_collection.Count, Is.EqualTo(1));
|
||||
Assert.That(_collection, Has.Count.EqualTo(1));
|
||||
Assert.That(_collection.QueryBreakdowns[0], Is.EqualTo(query));
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class QueryBreakdownCollectionTests
|
||||
_collection.AddRange(queries);
|
||||
|
||||
// Assert
|
||||
Assert.That(_collection.Count, Is.EqualTo(2));
|
||||
Assert.That(_collection, Has.Count.EqualTo(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -89,7 +89,7 @@ public class QueryBreakdownCollectionTests
|
||||
|
||||
// Assert
|
||||
Assert.That(removed, Is.True);
|
||||
Assert.That(_collection.Count, Is.EqualTo(0));
|
||||
Assert.That(_collection, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -105,7 +105,7 @@ public class QueryBreakdownCollectionTests
|
||||
|
||||
// Assert
|
||||
Assert.That(removed, Is.False);
|
||||
Assert.That(_collection.Count, Is.EqualTo(1));
|
||||
Assert.That(_collection, Has.Count.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -119,7 +119,7 @@ public class QueryBreakdownCollectionTests
|
||||
_collection.Clear();
|
||||
|
||||
// Assert
|
||||
Assert.That(_collection.Count, Is.EqualTo(0));
|
||||
Assert.That(_collection, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -164,7 +164,7 @@ public class QueryBreakdownCollectionTests
|
||||
var results = _collection.WhereSelectContains("Email").ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(results.Count, Is.EqualTo(1));
|
||||
Assert.That(results, Has.Count.EqualTo(1));
|
||||
Assert.That(results[0], Is.EqualTo(query1));
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class QueryBreakdownCollectionTests
|
||||
var results = _collection.WhereSelectContains("email").ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(results.Count, Is.EqualTo(1));
|
||||
Assert.That(results, Has.Count.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -195,7 +195,7 @@ public class QueryBreakdownCollectionTests
|
||||
var results = _collection.WhereTableContains("Users").ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(results.Count, Is.EqualTo(1));
|
||||
Assert.That(results, Has.Count.EqualTo(1));
|
||||
Assert.That(results[0], Is.EqualTo(query1));
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ public class QueryBreakdownCollectionTests
|
||||
var results = _collection.WhereHaveWhereClause().ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(results.Count, Is.EqualTo(1));
|
||||
Assert.That(results, Has.Count.EqualTo(1));
|
||||
Assert.That(results[0], Is.EqualTo(query1));
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ public class QueryBreakdownCollectionTests
|
||||
var results = _collection.WhereHaveNoWhereClause().ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(results.Count, Is.EqualTo(1));
|
||||
Assert.That(results, Has.Count.EqualTo(1));
|
||||
Assert.That(results[0], Is.EqualTo(query2));
|
||||
}
|
||||
|
||||
@@ -259,7 +259,7 @@ public class QueryBreakdownCollectionTests
|
||||
var tables = _collection.GetUniqueTableReferences().ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(tables.Count, Is.EqualTo(2));
|
||||
Assert.That(tables, Has.Count.EqualTo(2));
|
||||
Assert.That(tables, Does.Contain("Users"));
|
||||
Assert.That(tables, Does.Contain("Orders"));
|
||||
}
|
||||
@@ -275,7 +275,7 @@ public class QueryBreakdownCollectionTests
|
||||
var summaries = _collection.GetQuerySummaries().ToList();
|
||||
|
||||
// Assert
|
||||
Assert.That(summaries.Count, Is.EqualTo(2));
|
||||
Assert.That(summaries, Has.Count.EqualTo(2));
|
||||
Assert.That(summaries[0].HasSelectClause, Is.True);
|
||||
Assert.That(summaries[1].HasWhereClause, Is.True);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class QueryBreakdownTests
|
||||
Assert.That(query.SetupClauses, Is.Not.Null);
|
||||
Assert.That(query.FinishClauses, Is.Not.Null);
|
||||
Assert.That(query.WithClauses, Is.Not.Null);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(0));
|
||||
Assert.That(query.WithClauses, Is.Empty);
|
||||
Assert.That(query.Parameters, Is.Not.Null);
|
||||
Assert.That(query.ParameterList, Is.Not.Null);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ public class QueryBreakdownTests
|
||||
var merged = query.GetMergedParameters();
|
||||
|
||||
// Assert
|
||||
Assert.That(merged.Count, Is.EqualTo(2));
|
||||
Assert.That(merged, Has.Count.EqualTo(2));
|
||||
Assert.That(merged["@UserId"], Is.EqualTo(123));
|
||||
Assert.That(merged["@ActiveStatus"], Is.EqualTo(true));
|
||||
}
|
||||
@@ -228,7 +228,7 @@ public class QueryBreakdownTests
|
||||
var merged = mainQuery.GetMergedParameters();
|
||||
|
||||
// Assert
|
||||
Assert.That(merged.Count, Is.EqualTo(2));
|
||||
Assert.That(merged, Has.Count.EqualTo(2));
|
||||
Assert.That(merged["@MinDate"], Is.EqualTo(DateTime.Today.AddDays(-30)));
|
||||
Assert.That(merged["@Limit"], Is.EqualTo(100));
|
||||
}
|
||||
@@ -252,7 +252,7 @@ public class QueryBreakdownTests
|
||||
var merged = mainQuery.GetMergedParameters();
|
||||
|
||||
// Assert
|
||||
Assert.That(merged.Count, Is.EqualTo(3));
|
||||
Assert.That(merged, Has.Count.EqualTo(3));
|
||||
Assert.That(merged["@Status1"], Is.EqualTo("active"));
|
||||
Assert.That(merged["@MinDate"], Is.EqualTo(DateTime.Today.AddDays(-30)));
|
||||
Assert.That(merged["@ResultLimit"], Is.EqualTo(50));
|
||||
@@ -273,7 +273,7 @@ public class QueryBreakdownTests
|
||||
var merged = mainQuery.GetMergedParameters();
|
||||
|
||||
// Assert
|
||||
Assert.That(merged.Count, Is.EqualTo(1));
|
||||
Assert.That(merged, Has.Count.EqualTo(1));
|
||||
Assert.That(merged["@Limit"], Is.EqualTo(100)); // Main query value wins
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ public class QueryBreakdownTests
|
||||
var merged = mainQuery.GetMergedParameters();
|
||||
|
||||
// Assert - All parameters from all levels should be present
|
||||
Assert.That(merged.Count, Is.EqualTo(3));
|
||||
Assert.That(merged, Has.Count.EqualTo(3));
|
||||
Assert.That(merged["@InnerParam"], Is.EqualTo("inner_value"));
|
||||
Assert.That(merged["@MiddleParam"], Is.EqualTo("middle_value"));
|
||||
Assert.That(merged["@MainParam"], Is.EqualTo("main_value"));
|
||||
@@ -317,7 +317,7 @@ public class QueryBreakdownTests
|
||||
var merged = mainQuery.GetMergedParameters();
|
||||
|
||||
// Assert
|
||||
Assert.That(merged.Count, Is.EqualTo(0));
|
||||
Assert.That(merged, Is.Empty);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -464,7 +464,7 @@ public class QueryBreakdownTests
|
||||
query.AddWhereClause("CreatedDate > @StartDate", "and");
|
||||
|
||||
// Assert
|
||||
Assert.That(query.Parameters.Count, Is.EqualTo(3));
|
||||
Assert.That(query.Parameters, Has.Count.EqualTo(3));
|
||||
Assert.That(query.Parameters, Does.ContainKey("@UserId"));
|
||||
Assert.That(query.Parameters, Does.ContainKey("@Status"));
|
||||
Assert.That(query.Parameters, Does.ContainKey("@StartDate"));
|
||||
@@ -566,7 +566,7 @@ public class QueryBreakdownTests
|
||||
mainQuery.AddWithClause("ProductOrders", cteQuery);
|
||||
|
||||
// Assert
|
||||
Assert.That(mainQuery.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(mainQuery.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(mainQuery.WithClauses[0].TableName, Is.EqualTo("ProductOrders"));
|
||||
Assert.That(mainQuery.WithClauses[0].Query, Is.EqualTo(cteQuery));
|
||||
}
|
||||
@@ -586,7 +586,7 @@ public class QueryBreakdownTests
|
||||
mainQuery.AddWithClause("CTE3", cte3);
|
||||
|
||||
// Assert
|
||||
Assert.That(mainQuery.WithClauses.Count, Is.EqualTo(3));
|
||||
Assert.That(mainQuery.WithClauses, Has.Count.EqualTo(3));
|
||||
Assert.That(mainQuery.WithClauses[0].TableName, Is.EqualTo("CTE1"));
|
||||
Assert.That(mainQuery.WithClauses[1].TableName, Is.EqualTo("CTE2"));
|
||||
Assert.That(mainQuery.WithClauses[2].TableName, Is.EqualTo("CTE3"));
|
||||
@@ -603,7 +603,7 @@ public class QueryBreakdownTests
|
||||
mainQuery.AddWithClause("ProductOrders", cteSql, isMicrosoftSql: true);
|
||||
|
||||
// Assert
|
||||
Assert.That(mainQuery.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(mainQuery.WithClauses, Has.Count.EqualTo(1));
|
||||
Assert.That(mainQuery.WithClauses[0].TableName, Is.EqualTo("ProductOrders"));
|
||||
Assert.That(mainQuery.WithClauses[0].Query!.SelectClause.Clause, Does.Contain("ProductID"));
|
||||
Assert.That(mainQuery.WithClauses[0].Query!.GroupByClause.Clause, Does.Contain("ProductID"));
|
||||
@@ -769,7 +769,7 @@ public class QueryBreakdownTests
|
||||
|
||||
// Assert - Now using WITH clause
|
||||
Assert.That(query.IsUsingWithClause, Is.True);
|
||||
Assert.That(query.WithClauses.Count, Is.EqualTo(1));
|
||||
Assert.That(query.WithClauses, Has.Count.EqualTo(1));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -246,8 +246,8 @@ public class RecursiveCTETests
|
||||
|
||||
// Assert
|
||||
Assert.That(sql, Contains.Substring("WITH RECURSIVE"));
|
||||
Assert.That(sql.Contains("base AS"), "Non-recursive CTE should be included");
|
||||
Assert.That(sql.Contains("tree_hierarchy AS"), "Recursive CTE should be included");
|
||||
Assert.That(sql, Does.Contain("base AS"), "Non-recursive CTE should be included");
|
||||
Assert.That(sql, Does.Contain("tree_hierarchy AS"), "Recursive CTE should be included");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user