From 6b23e69075863dbb9e35b4fc329f05be36eace98 Mon Sep 17 00:00:00 2001 From: Jiri Cincura Date: Sun, 28 Jan 2024 13:52:44 +0100 Subject: [PATCH] More tests --- .../Query/FunkyDataQueryFbTest.cs | 8 ++++++++ .../Query/GearsOfWarQueryFbTest.cs | 14 ++++++++++++++ .../Internal/FbStringContainsTranslator.cs | 5 +++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/FunkyDataQueryFbTest.cs b/src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/FunkyDataQueryFbTest.cs index 8510b7af3..da2911974 100644 --- a/src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/FunkyDataQueryFbTest.cs +++ b/src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/FunkyDataQueryFbTest.cs @@ -16,6 +16,7 @@ //$Authors = Jiri Cincura (jiri@cincura.net) using System.Linq; +using System.Threading.Tasks; using FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests.Helpers; using FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests.TestUtilities; using Microsoft.EntityFrameworkCore; @@ -31,6 +32,13 @@ public FunkyDataQueryFbTest(FunkyDataQueryFbFixture fixture) : base(fixture) { } + [Theory] + [MemberData(nameof(IsAsyncData))] + public override Task String_contains_on_argument_with_wildcard_column(bool async) + { + return base.String_contains_on_argument_with_wildcard_column(async); + } + public class FunkyDataQueryFbFixture : FunkyDataQueryFixtureBase { protected override ITestStoreFactory TestStoreFactory => FbTestStoreFactory.Instance; diff --git a/src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/GearsOfWarQueryFbTest.cs b/src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/GearsOfWarQueryFbTest.cs index 3d832cce1..7341a31b7 100644 --- a/src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/GearsOfWarQueryFbTest.cs +++ b/src/FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests/Query/GearsOfWarQueryFbTest.cs @@ -390,6 +390,20 @@ public override Task Correlated_collection_with_groupby_with_complex_grouping_ke return base.Correlated_collection_with_groupby_with_complex_grouping_key_not_projecting_identifier_column_with_group_aggregate_in_final_projection(async); } + [NotSupportedByProviderTheory] + [MemberData(nameof(IsAsyncData))] + public override Task DateTimeOffset_to_unix_time_milliseconds(bool async) + { + return base.DateTimeOffset_to_unix_time_milliseconds(async); + } + + [NotSupportedByProviderTheory] + [MemberData(nameof(IsAsyncData))] + public override Task DateTimeOffset_to_unix_time_seconds(bool async) + { + return base.DateTimeOffset_to_unix_time_seconds(async); + } + [Theory(Skip = "NETProvider#1008")] [MemberData(nameof(IsAsyncData))] public override Task Where_TimeOnly_IsBetween(bool async) diff --git a/src/FirebirdSql.EntityFrameworkCore.Firebird/Query/ExpressionTranslators/Internal/FbStringContainsTranslator.cs b/src/FirebirdSql.EntityFrameworkCore.Firebird/Query/ExpressionTranslators/Internal/FbStringContainsTranslator.cs index 87ec77169..bc1905ad9 100644 --- a/src/FirebirdSql.EntityFrameworkCore.Firebird/Query/ExpressionTranslators/Internal/FbStringContainsTranslator.cs +++ b/src/FirebirdSql.EntityFrameworkCore.Firebird/Query/ExpressionTranslators/Internal/FbStringContainsTranslator.cs @@ -50,14 +50,15 @@ public SqlExpression Translate(SqlExpression instance, MethodInfo method, IReadO new[] { true, true }, typeof(int)), _fbSqlExpressionFactory.Constant(0)); - return patternExpression is SqlConstantExpression sqlConstantExpression + var matchingExpression = patternExpression is SqlConstantExpression sqlConstantExpression ? ((string)sqlConstantExpression.Value)?.Length == 0 ? (SqlExpression)_fbSqlExpressionFactory.Constant(true) - : positionExpression + : (SqlExpression)positionExpression : _fbSqlExpressionFactory.OrElse( positionExpression, _fbSqlExpressionFactory.Equal( _fbSqlExpressionFactory.Function("CHAR_LENGTH", new[] { patternExpression }, true, new[] { true }, typeof(int)), _fbSqlExpressionFactory.Constant(0))); + return _fbSqlExpressionFactory.AndAlso(matchingExpression, _fbSqlExpressionFactory.AndAlso(_fbSqlExpressionFactory.IsNotNull(instance), _fbSqlExpressionFactory.IsNotNull(patternExpression))); } }