|
| 1 | +// Copyright (c) .NET Foundation. All rights reserved. |
| 2 | +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. |
| 3 | + |
| 4 | +using System.Threading.Tasks; |
| 5 | +using Xunit; |
| 6 | +using Xunit.Abstractions; |
| 7 | + |
| 8 | +namespace Microsoft.EntityFrameworkCore.Query |
| 9 | +{ |
| 10 | + public class TPTGearsOfWarQuerySqliteTest : TPTGearsOfWarQueryRelationalTestBase<TPTGearsOfWarQuerySqliteFixture> |
| 11 | + { |
| 12 | + public TPTGearsOfWarQuerySqliteTest(TPTGearsOfWarQuerySqliteFixture fixture, ITestOutputHelper testOutputHelper) |
| 13 | + : base(fixture) |
| 14 | + { |
| 15 | + Fixture.TestSqlLoggerFactory.Clear(); |
| 16 | + //Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); |
| 17 | + } |
| 18 | + |
| 19 | + public override Task Where_datetimeoffset_date_component(bool async) |
| 20 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_date_component(async)); |
| 21 | + |
| 22 | + public override Task Where_datetimeoffset_day_component(bool async) |
| 23 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_date_component(async)); |
| 24 | + |
| 25 | + public override Task Where_datetimeoffset_dayofyear_component(bool async) |
| 26 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_dayofyear_component(async)); |
| 27 | + |
| 28 | + public override Task Where_datetimeoffset_hour_component(bool async) |
| 29 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_hour_component(async)); |
| 30 | + |
| 31 | + public override Task Where_datetimeoffset_millisecond_component(bool async) |
| 32 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_millisecond_component(async)); |
| 33 | + |
| 34 | + public override Task Where_datetimeoffset_minute_component(bool async) |
| 35 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_minute_component(async)); |
| 36 | + |
| 37 | + public override Task Where_datetimeoffset_month_component(bool async) |
| 38 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_month_component(async)); |
| 39 | + |
| 40 | + public override Task Where_datetimeoffset_now(bool async) |
| 41 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_now(async)); |
| 42 | + |
| 43 | + public override Task Where_datetimeoffset_second_component(bool async) |
| 44 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_second_component(async)); |
| 45 | + |
| 46 | + public override Task Where_datetimeoffset_utcnow(bool async) |
| 47 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_utcnow(async)); |
| 48 | + |
| 49 | + public override Task Where_datetimeoffset_year_component(bool async) |
| 50 | + => AssertTranslationFailed(() => base.Where_datetimeoffset_year_component(async)); |
| 51 | + |
| 52 | + public override Task DateTimeOffset_Contains_Less_than_Greater_than(bool async) |
| 53 | + => AssertTranslationFailed(() => base.DateTimeOffset_Contains_Less_than_Greater_than(async)); |
| 54 | + |
| 55 | + public override Task DateTimeOffset_Date_returns_datetime(bool async) |
| 56 | + => AssertTranslationFailed(() => base.DateTimeOffset_Date_returns_datetime(async)); |
| 57 | + |
| 58 | + // Sqlite does not support cross/outer apply |
| 59 | + public override Task Correlated_collections_inner_subquery_predicate_references_outer_qsre(bool async) => null; |
| 60 | + |
| 61 | + public override Task Correlated_collections_inner_subquery_selector_references_outer_qsre(bool async) => null; |
| 62 | + |
| 63 | + public override Task Correlated_collections_nested_inner_subquery_references_outer_qsre_one_level_up(bool async) => null; |
| 64 | + |
| 65 | + public override Task Correlated_collections_nested_inner_subquery_references_outer_qsre_two_levels_up(bool async) => null; |
| 66 | + |
| 67 | + public override Task Outer_parameter_in_group_join_with_DefaultIfEmpty(bool async) => null; |
| 68 | + |
| 69 | + public override Task Outer_parameter_in_join_key(bool async) => null; |
| 70 | + |
| 71 | + public override Task Outer_parameter_in_join_key_inner_and_outer(bool async) => null; |
| 72 | + |
| 73 | + public override Task Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion(bool async) => null; |
| 74 | + |
| 75 | + public override Task Subquery_projecting_nullable_scalar_contains_nullable_value_needs_null_expansion_negated(bool async) => null; |
| 76 | + |
| 77 | + public override Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion(bool async) => null; |
| 78 | + |
| 79 | + public override Task Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion_negated(bool async) => null; |
| 80 | + |
| 81 | + public override async Task Negate_on_binary_expression(bool async) |
| 82 | + { |
| 83 | + await base.Negate_on_binary_expression(async); |
| 84 | + |
| 85 | + AssertSql( |
| 86 | + @"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" |
| 87 | +FROM ""Squads"" AS ""s"" |
| 88 | +WHERE ""s"".""Id"" = -(""s"".""Id"" + ""s"".""Id"")"); |
| 89 | + } |
| 90 | + |
| 91 | + public override async Task Negate_on_column(bool async) |
| 92 | + { |
| 93 | + await base.Negate_on_column(async); |
| 94 | + |
| 95 | + AssertSql( |
| 96 | + @"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" |
| 97 | +FROM ""Squads"" AS ""s"" |
| 98 | +WHERE ""s"".""Id"" = -""s"".""Id"""); |
| 99 | + } |
| 100 | + |
| 101 | + public override async Task Negate_on_like_expression(bool async) |
| 102 | + { |
| 103 | + await base.Negate_on_like_expression(async); |
| 104 | + |
| 105 | + AssertSql( |
| 106 | + @"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" |
| 107 | +FROM ""Squads"" AS ""s"" |
| 108 | +WHERE ""s"".""Name"" IS NOT NULL AND NOT (""s"".""Name"" LIKE 'us%')"); |
| 109 | + } |
| 110 | + |
| 111 | + public override async Task Select_datetimeoffset_comparison_in_projection(bool async) |
| 112 | + { |
| 113 | + await base.Select_datetimeoffset_comparison_in_projection(async); |
| 114 | + |
| 115 | + AssertSql( |
| 116 | + @"SELECT ""m"".""Timeline"" |
| 117 | +FROM ""Missions"" AS ""m"""); |
| 118 | + } |
| 119 | + |
| 120 | + public override async Task Byte_array_contains_literal(bool async) |
| 121 | + { |
| 122 | + await base.Byte_array_contains_literal(async); |
| 123 | + |
| 124 | + AssertSql( |
| 125 | + @"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" |
| 126 | +FROM ""Squads"" AS ""s"" |
| 127 | +WHERE instr(""s"".""Banner"", X'01') > 0"); |
| 128 | + } |
| 129 | + |
| 130 | + public override async Task Byte_array_contains_parameter(bool async) |
| 131 | + { |
| 132 | + await base.Byte_array_contains_parameter(async); |
| 133 | + |
| 134 | + AssertSql( |
| 135 | + @"@__someByte_0='1' (DbType = String) |
| 136 | +
|
| 137 | +SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" |
| 138 | +FROM ""Squads"" AS ""s"" |
| 139 | +WHERE instr(""s"".""Banner"", char(@__someByte_0)) > 0"); |
| 140 | + } |
| 141 | + |
| 142 | + public override async Task Byte_array_filter_by_length_literal(bool async) |
| 143 | + { |
| 144 | + await base.Byte_array_filter_by_length_literal(async); |
| 145 | + |
| 146 | + AssertSql(@"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" |
| 147 | +FROM ""Squads"" AS ""s"" |
| 148 | +WHERE length(""s"".""Banner"") = 1"); |
| 149 | + } |
| 150 | + |
| 151 | + public override async Task Byte_array_filter_by_length_parameter(bool async) |
| 152 | + { |
| 153 | + await base.Byte_array_filter_by_length_parameter(async); |
| 154 | + |
| 155 | + AssertSql(@"@__p_0='1' (DbType = String) |
| 156 | +
|
| 157 | +SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" |
| 158 | +FROM ""Squads"" AS ""s"" |
| 159 | +WHERE length(""s"".""Banner"") = @__p_0"); |
| 160 | + } |
| 161 | + |
| 162 | + public override void Byte_array_filter_by_length_parameter_compiled() |
| 163 | + { |
| 164 | + base.Byte_array_filter_by_length_parameter_compiled(); |
| 165 | + |
| 166 | + AssertSql( |
| 167 | + @"@__byteArrayParam='0x2A80' (Size = 2) (DbType = String) |
| 168 | +
|
| 169 | +SELECT COUNT(*) |
| 170 | +FROM ""Squads"" AS ""s"" |
| 171 | +WHERE length(""s"".""Banner"") = length(@__byteArrayParam)"); |
| 172 | + } |
| 173 | + |
| 174 | + public override async Task Byte_array_filter_by_SequenceEqual(bool async) |
| 175 | + { |
| 176 | + await base.Byte_array_filter_by_SequenceEqual(async); |
| 177 | + |
| 178 | + AssertSql(@"@__byteArrayParam_0='0x0405060708' (Size = 5) (DbType = String) |
| 179 | +
|
| 180 | +SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" |
| 181 | +FROM ""Squads"" AS ""s"" |
| 182 | +WHERE ""s"".""Banner5"" = @__byteArrayParam_0"); |
| 183 | + } |
| 184 | + |
| 185 | + [ConditionalTheory(Skip = "Issue#18844")] |
| 186 | + public override Task TimeSpan_Hours(bool async) => base.TimeSpan_Hours(async); |
| 187 | + |
| 188 | + [ConditionalTheory(Skip = "Issue#18844")] |
| 189 | + public override Task TimeSpan_Minutes(bool async) => base.TimeSpan_Minutes(async); |
| 190 | + |
| 191 | + [ConditionalTheory(Skip = "Issue#18844")] |
| 192 | + public override Task TimeSpan_Seconds(bool async) => base.TimeSpan_Seconds(async); |
| 193 | + |
| 194 | + [ConditionalTheory(Skip = "Issue#18844")] |
| 195 | + public override Task TimeSpan_Milliseconds(bool async) => base.TimeSpan_Milliseconds(async); |
| 196 | + |
| 197 | + [ConditionalTheory(Skip = "Issue#18844")] |
| 198 | + public override Task Where_TimeSpan_Hours(bool async) => base.Where_TimeSpan_Hours(async); |
| 199 | + |
| 200 | + [ConditionalTheory(Skip = "Issue#18844")] |
| 201 | + public override Task Where_TimeSpan_Minutes(bool async) => base.Where_TimeSpan_Minutes(async); |
| 202 | + |
| 203 | + [ConditionalTheory(Skip = "Issue#18844")] |
| 204 | + public override Task Where_TimeSpan_Seconds(bool async) => base.Where_TimeSpan_Seconds(async); |
| 205 | + |
| 206 | + [ConditionalTheory(Skip = "Issue#18844")] |
| 207 | + public override Task Where_TimeSpan_Milliseconds(bool async) => base.Where_TimeSpan_Milliseconds(async); |
| 208 | + |
| 209 | + private void AssertSql(params string[] expected) |
| 210 | + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); |
| 211 | + } |
| 212 | +} |
0 commit comments