Files
Thom LambandClaude Opus 4.7 4fe9eb36e6
SonarQube Analysis / sonarqube (pull_request) Successful in 2m59s
chore(sonar): second sweep — catch .Length, Is.Not.Empty, and newly-exposed Multiple groups (NUnit2046, NUnit2045)
Re-runs `dotnet format analyzers --diagnostics NUnit2046 NUnit2045` after
the Tier 2 Assert.Multiple wrap, which exposed:

- `Has.Length.EqualTo(n)` rewrites for `string[]`/array `.Length` checks
  (the first pass only knew about `.Count`).
- `Is.Not.Empty` rewrites for `Count, Is.GreaterThan(0)`.
- A handful of new NUnit2045 groups that became wrappable once the
  initial Multiple blocks settled the surrounding indentation.

Tests still 1180/1180 passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 12:14:13 -05:00

47 lines
1.7 KiB
C#

using Strata.SqlTools.SqlBreakdown.Classes;
using Strata.SqlTools.SqlBreakdown.Expressions;
namespace Strata.SqlTools.SqlBreakdown.Tests.ExpressionTests;
[TestFixture]
public class DateFunctionTests : ExpressionTestsBase
{
private static IEnumerable<TestCaseData> DateFunctionTestCases()
{
var testCases = new[]
{
new ExpressionTestCase
{
Name = "GetFiscalYearMonthExpression_{m}",
Arrange = new Dictionary<string, Expression>
{
["dischargeDate"] = new RegisteredTableColumnExpression(4, "DISCHARGE_DATE", new RegisteredTableSource(101, "CLIENT_DSS", "DEPT", "PES"))
},
Act = (columns, visitor) =>
{
var dischargeDate = columns["dischargeDate"];
var fiscal = TestExpressionFactory.GetFiscalYearMonthExpression(dischargeDate, 7, 1);
return fiscal.Accept(visitor);
},
Assertions = result =>
{
var sql = (string)result;
Assert.That(sql, Is.Not.Null);
Assert.That(sql, Is.Not.Empty);
Assert.That(sql, Is.EqualTo("DATE_TRUNC('month', DATEADD('month', 6, PES.DISCHARGE_DATE))"));
return true;
}
}
};
foreach (var testCase in testCases)
{
yield return new TestCaseData(testCase).SetName(testCase.Name);
}
}
[TestCaseSource(nameof(DateFunctionTestCases))]
public void DateFunction_GeneratesCorrectSql(ExpressionTestCase testCase)
=> ExecuteExpressionTest(testCase);
}