From 539083d9bcfddca19803b6e22de76e09db4a3c95 Mon Sep 17 00:00:00 2001 From: Mark Carrington <31017244+MarkMpn@users.noreply.github.com> Date: Fri, 21 Jun 2024 18:05:22 +0100 Subject: [PATCH] Updated tests with new not-null filters --- .../ExecutionPlanTests.cs | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/MarkMpn.Sql4Cds.Engine.Tests/ExecutionPlanTests.cs b/MarkMpn.Sql4Cds.Engine.Tests/ExecutionPlanTests.cs index 230e7084..ecd31ba7 100644 --- a/MarkMpn.Sql4Cds.Engine.Tests/ExecutionPlanTests.cs +++ b/MarkMpn.Sql4Cds.Engine.Tests/ExecutionPlanTests.cs @@ -242,7 +242,9 @@ public void NonUniqueJoinExpression() "); - var contactComputeScalar = AssertNode(join.RightSource); + var contactFilter = AssertNode(join.RightSource); + Assert.AreEqual("Expr1 IS NOT NULL", contactFilter.Filter.ToSql()); + var contactComputeScalar = AssertNode(contactFilter.Source); var contactFetch = AssertNode(contactComputeScalar.Source); AssertFetchXml(contactFetch, @" @@ -3099,7 +3101,9 @@ public void FoldFilterWithNonFoldedJoin() var select = AssertNode(plans[0]); var join = AssertNode(select.Source); - var leftCompute = AssertNode(join.LeftSource); + var leftFilter = AssertNode(join.LeftSource); + Assert.AreEqual("Expr1 IS NOT NULL", leftFilter.Filter.ToSql()); + var leftCompute = AssertNode(leftFilter.Source); var leftFetch = AssertNode(leftCompute.Source); AssertFetchXml(leftFetch, @" @@ -3110,7 +3114,9 @@ public void FoldFilterWithNonFoldedJoin() "); - var rightCompute = AssertNode(join.RightSource); + var rightFilter = AssertNode(join.RightSource); + Assert.AreEqual("Expr2 IS NOT NULL", rightFilter.Filter.ToSql()); + var rightCompute = AssertNode(rightFilter.Source); var rightFetch = AssertNode(rightCompute.Source); AssertFetchXml(rightFetch, @" @@ -5832,9 +5838,27 @@ public void ExplicitCollation() Assert.AreEqual("p.name", join.LeftAttribute.ToSql()); Assert.AreEqual("Expr1", join.RightAttribute.ToSql()); var fetch1 = AssertNode(join.LeftSource); - var computeScalar = AssertNode(join.RightSource); + + AssertFetchXml(fetch1, @" + + + + + + + + "); + var filter = AssertNode(join.RightSource); + Assert.AreEqual("Expr1 IS NOT NULL", filter.Filter.ToSql()); + var computeScalar = AssertNode(filter.Source); Assert.AreEqual("ExplicitCollation(f.name COLLATE French_CI_AS)", computeScalar.Columns["Expr1"].ToSql()); var fetch2 = AssertNode(computeScalar.Source); + AssertFetchXml(fetch2, @" + + + + + "); } [TestMethod]