From 84c47a04c4aebcb63a5651f9f0ba8ed0549d88bc Mon Sep 17 00:00:00 2001 From: Laurents Meyer Date: Thu, 12 Oct 2023 18:32:21 +0200 Subject: [PATCH] Revert "Fix build errors." This reverts commit ad5dbd81173ad0b4caea6bdb32a5a70bd5897504. --- .../Query/ComplexTypeQueryJetTest.cs | 7 + ...teOperatorsQueryJetTest.ResultOperators.cs | 206 ++++++++++++++++++ .../Query/OwnedEntityQuerySqlServerTest.cs | 24 ++ 3 files changed, 237 insertions(+) diff --git a/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs b/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs index 5d4293d..aee654e 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/ComplexTypeQueryJetTest.cs @@ -249,6 +249,13 @@ WHERE `c`.`ShippingAddress_AddressLine1` = @__entity_equality_address_0_AddressL """); } + public override async Task Complex_type_equals_null(bool async) + { + await base.Complex_type_equals_null(async); + + AssertSql(); + } + public override async Task Subquery_over_complex_type(bool async) { await base.Subquery_over_complex_type(async); diff --git a/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs b/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs index f948d01..c8a4a4a 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/NorthwindAggregateOperatorsQueryJetTest.ResultOperators.cs @@ -1555,6 +1555,212 @@ FROM `Customers` AS `c` WHERE `c`.`CustomerID` IN ('ABCDE', 'ANATR')"); } + public override async Task Contains_with_local_enumerable_closure(bool async) + { + await base.Contains_with_local_enumerable_closure(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ALFKI') +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = 'ABCDE' +"""); + } + + public override async Task Contains_with_local_object_enumerable_closure(bool async) + { + await base.Contains_with_local_object_enumerable_closure(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ALFKI') +"""); + } + + public override async Task Contains_with_local_enumerable_closure_all_null(bool async) + { + await base.Contains_with_local_enumerable_closure_all_null(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE 0 = 1 +"""); + } + + public override async Task Contains_with_local_enumerable_inline(bool async) + { + // Issue #31776 + await Assert.ThrowsAsync( + async () => + await base.Contains_with_local_enumerable_inline(async)); + + AssertSql(); + } + + public override async Task Contains_with_local_enumerable_inline_closure_mix(bool async) + { + // Issue #31776 + await Assert.ThrowsAsync( + async () => + await base.Contains_with_local_enumerable_inline_closure_mix(async)); + + AssertSql(); + } + + public override async Task Contains_with_local_ordered_enumerable_closure(bool async) + { + await base.Contains_with_local_ordered_enumerable_closure(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ALFKI') +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = 'ABCDE' +"""); + } + + public override async Task Contains_with_local_object_ordered_enumerable_closure(bool async) + { + await base.Contains_with_local_object_ordered_enumerable_closure(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ALFKI') +"""); + } + + public override async Task Contains_with_local_ordered_enumerable_closure_all_null(bool async) + { + await base.Contains_with_local_ordered_enumerable_closure_all_null(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE 0 = 1 +"""); + } + + public override async Task Contains_with_local_ordered_enumerable_inline(bool async) + { + await base.Contains_with_local_ordered_enumerable_inline(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ALFKI') +"""); + } + + public override async Task Contains_with_local_ordered_enumerable_inline_closure_mix(bool async) + { + await base.Contains_with_local_ordered_enumerable_inline_closure_mix(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ALFKI') +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ANATR') +"""); + } + + public override async Task Contains_with_local_read_only_collection_closure(bool async) + { + await base.Contains_with_local_read_only_collection_closure(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ALFKI') +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` = 'ABCDE' +"""); + } + + public override async Task Contains_with_local_object_read_only_collection_closure(bool async) + { + await base.Contains_with_local_object_read_only_collection_closure(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ALFKI') +"""); + } + + public override async Task Contains_with_local_ordered_read_only_collection_all_null(bool async) + { + await base.Contains_with_local_ordered_read_only_collection_all_null(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE 0 = 1 +"""); + } + + public override async Task Contains_with_local_read_only_collection_inline(bool async) + { + await base.Contains_with_local_read_only_collection_inline(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ALFKI') +"""); + } + + public override async Task Contains_with_local_read_only_collection_inline_closure_mix(bool async) + { + await base.Contains_with_local_read_only_collection_inline_closure_mix(async); + + AssertSql( + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ALFKI') +""", + // + """ +SELECT `c`.`CustomerID`, `c`.`Address`, `c`.`City`, `c`.`CompanyName`, `c`.`ContactName`, `c`.`ContactTitle`, `c`.`Country`, `c`.`Fax`, `c`.`Phone`, `c`.`PostalCode`, `c`.`Region` +FROM `Customers` AS `c` +WHERE `c`.`CustomerID` IN ('ABCDE', 'ANATR') +"""); + } + public override async Task Contains_with_local_non_primitive_list_closure_mix(bool isAsync) { await base.Contains_with_local_non_primitive_list_closure_mix(isAsync); diff --git a/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs b/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs index 8ddcf0b..53e103f 100644 --- a/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs +++ b/test/EFCore.Jet.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs @@ -171,6 +171,30 @@ WHERE `r`.`Rot_ApartmentNo` IS NOT NULL OR `r`.`Rot_ServiceType` IS NOT NULL """); } + public override async Task Owned_entity_with_all_null_properties_in_compared_to_null_in_conditional_projection(bool async) + { + await base.Owned_entity_with_all_null_properties_in_compared_to_null_in_conditional_projection(async); + + AssertSql( + """ +SELECT IIF(`r`.`Rot_ApartmentNo` IS NULL AND `r`.`Rot_ServiceType` IS NULL, TRUE, FALSE), `r`.`Rot_ApartmentNo`, `r`.`Rot_ServiceType` +FROM `RotRutCases` AS `r` +ORDER BY `r`.`Id` +"""); + } + + public override async Task Owned_entity_with_all_null_properties_in_compared_to_non_null_in_conditional_projection(bool async) + { + await base.Owned_entity_with_all_null_properties_in_compared_to_non_null_in_conditional_projection(async); + + AssertSql( + """ +SELECT IIF(`r`.`Rot_ApartmentNo` IS NOT NULL OR `r`.`Rot_ServiceType` IS NOT NULL, TRUE, FALSE), `r`.`Rot_ApartmentNo`, `r`.`Rot_ServiceType` +FROM `RotRutCases` AS `r` +ORDER BY `r`.`Id` +"""); + } + public override async Task Owned_entity_with_all_null_properties_property_access_when_not_containing_another_owned_entity(bool async) { await base.Owned_entity_with_all_null_properties_property_access_when_not_containing_another_owned_entity(async);