Skip to content

Commit 11c6635

Browse files
committed
Fix SQL Server tests
1 parent 8acfa9d commit 11c6635

44 files changed

Lines changed: 951 additions & 192 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

eng/Versions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<OpenTelemetryExporterInMemoryVersion>1.15.1</OpenTelemetryExporterInMemoryVersion>
5353
<SQLitePCLRawVersion>3.0.3</SQLitePCLRawVersion>
5454
<SQLite3MCPCLRawBundleVersion>2.3.2</SQLite3MCPCLRawBundleVersion>
55+
<XUnitV3Version>4.0.0-pre.108</XUnitV3Version>
5556
<MicrosoftDotNetXUnitV3ExtensionsVersion>11.0.0-beta.26263.112</MicrosoftDotNetXUnitV3ExtensionsVersion>
5657
<MicrosoftTestingPlatformVersion>2.2.2</MicrosoftTestingPlatformVersion>
5758
</PropertyGroup>

test/Directory.Build.props

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
<NuGetAudit>false</NuGetAudit>
99
</PropertyGroup>
1010

11-
<PropertyGroup Condition="'$(IsUnitTestProject)' == 'true'">
12-
<TestRunnerName>XUnitV3</TestRunnerName>
11+
<PropertyGroup Condition="'$(IsTestProject)' != 'false'">
12+
<OutputType>Exe</OutputType>
13+
<TestRunnerName>XUnitV3</TestRunnerName>
1314
</PropertyGroup>
1415

1516
</Project>

test/EFCore.AspNet.Specification.Tests/EFCore.AspNet.Specification.Tests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<Nullable>disable</Nullable>
99
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1010
<IsPackable>true</IsPackable>
11+
<!-- This project contains base tests to be used by providers, but is not itself a test project with
12+
tests to be executed. Disable test discovery. -->
13+
<IsTestProject>false</IsTestProject>
1114
<IncludeSymbols>true</IncludeSymbols>
1215
<ImplicitUsings>true</ImplicitUsings>
1316
<NoWarn>$(NoWarn);8981</NoWarn>

test/EFCore.SqlServer.FunctionalTests/BuiltInDataTypesSqlServerTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ WHERE DATEDIFF(millisecond, [m].[TimeSpanAsTime], @timeSpan) = 0
814814
public virtual void Can_query_using_DateDiffMicrosecond_using_TimeSpan()
815815
{
816816
using var context = CreateContext();
817-
var timeSpan = new TimeSpan(2, 1, 0);
817+
var timeSpan = new TimeSpan(11, 15, 13);
818818

819819
var results
820820
= context.Set<MappedNullableDataTypes>()
@@ -825,7 +825,7 @@ var results
825825
Assert.Empty(results);
826826
AssertSql(
827827
"""
828-
@timeSpan='02:01:00' (Nullable = true)
828+
@timeSpan='11:15:13' (Nullable = true)
829829
830830
SELECT [m].[Int]
831831
FROM [MappedNullableDataTypes] AS [m]
@@ -837,7 +837,7 @@ WHERE DATEDIFF(microsecond, [m].[TimeSpanAsTime], @timeSpan) = 0
837837
public virtual void Can_query_using_DateDiffNanosecond_using_TimeSpan()
838838
{
839839
using var context = CreateContext();
840-
var timeSpan = new TimeSpan(2, 1, 0);
840+
var timeSpan = new TimeSpan(11, 15, 13);
841841

842842
var results
843843
= context.Set<MappedNullableDataTypes>()
@@ -848,7 +848,7 @@ var results
848848
Assert.Empty(results);
849849
AssertSql(
850850
"""
851-
@timeSpan='02:01:00' (Nullable = true)
851+
@timeSpan='11:15:13' (Nullable = true)
852852
853853
SELECT [m].[Int]
854854
FROM [MappedNullableDataTypes] AS [m]

test/EFCore.SqlServer.FunctionalTests/Query/AdHocPrecompiledQuerySqlServerTest.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using Xunit.Sdk;
5+
46
namespace Microsoft.EntityFrameworkCore.Query;
57

68
public class AdHocPrecompiledQuerySqlServerTest(NonSharedFixture fixture, ITestOutputHelper testOutputHelper)
@@ -9,9 +11,17 @@ public class AdHocPrecompiledQuerySqlServerTest(NonSharedFixture fixture, ITestO
911
protected override bool AlwaysPrintGeneratedSources
1012
=> false;
1113

12-
[ConditionalFact(typeof(SqlServerTestEnvironment), nameof(SqlServerTestEnvironment.SupportsJsonPathExpressions))]
13-
public override async Task Index_no_evaluatability()
14+
public override async Task Index_no_evaluatability()
1415
{
16+
17+
if (!SqlServerTestEnvironment.SupportsJsonPathExpressions)
18+
19+
{
20+
21+
throw SkipException.ForSkip("Requires SupportsJsonPathExpressions");
22+
23+
}
24+
1525
await base.Index_no_evaluatability();
1626

1727
AssertSql(
@@ -22,9 +32,17 @@ WHERE CAST(JSON_VALUE([j].[IntList], '$[' + CAST([j].[Id] AS nvarchar(max)) + ']
2232
""");
2333
}
2434

25-
[ConditionalFact(typeof(SqlServerTestEnvironment), nameof(SqlServerTestEnvironment.SupportsJsonPathExpressions))]
26-
public override async Task Index_with_captured_variable()
35+
public override async Task Index_with_captured_variable()
2736
{
37+
38+
if (!SqlServerTestEnvironment.SupportsJsonPathExpressions)
39+
40+
{
41+
42+
throw SkipException.ForSkip("Requires SupportsJsonPathExpressions");
43+
44+
}
45+
2846
await base.Index_with_captured_variable();
2947

3048
AssertSql(

0 commit comments

Comments
 (0)