Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test verifying #15208 #16344

Merged
merged 1 commit into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7513,6 +7513,22 @@ public virtual Task Bool_projection_from_subquery_treated_appropriately_in_where
(cs, gs) => cs.Where(c => gs.OrderBy(g => g.Nickname).ThenBy(g => g.SquadId).FirstOrDefault().HasSoulPatch));
}

[ConditionalTheory] // issue #15208
[MemberData(nameof(IsAsyncData))]
public virtual Task DateTimeOffset_Contains_Less_than_Greater_than(bool isAsync)
{
var dto = new DateTimeOffset(599898024001234567, new TimeSpan(1, 30, 0));
var start = dto.AddDays(-1);
var end = dto.AddDays(1);
var dates = new DateTimeOffset[] { dto };

return AssertQuery<Mission>(
isAsync,
ms => ms.Where(m => start <= m.Timeline.Date &&
m.Timeline < end &&
dates.Contains(m.Timeline)));
}

protected GearsOfWarContext CreateContext() => Fixture.CreateContext();

protected virtual void ClearLog()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8446,6 +8446,18 @@ WHERE [g].[Discriminator] IN (N'Gear', N'Officer')
ORDER BY [g].[Nickname], [g].[SquadId]) = CAST(1 AS bit)");
}

public override async Task DateTimeOffset_Contains_Less_than_Greater_than(bool isAsync)
{
await base.DateTimeOffset_Contains_Less_than_Greater_than(isAsync);

AssertSql(
@"@__start_0='1902-01-01T10:00:00.1234567+01:30'
@__end_1='1902-01-03T10:00:00.1234567+01:30'

SELECT [m].[Id], [m].[CodeName], [m].[Rating], [m].[Timeline]
FROM [Missions] AS [m]
WHERE ((@__start_0 <= CAST(CONVERT(date, [m].[Timeline]) AS datetimeoffset)) AND ([m].[Timeline] < @__end_1)) AND [m].[Timeline] IN ('1902-01-02T10:00:00.1234567+01:30')"); }

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ public GearsOfWarQuerySqliteTest(GearsOfWarQuerySqliteFixture fixture)

// Skip for SQLite. Issue #14935. Cannot eval 'where ([m].Timeline.Year == 2)'
public override Task Where_datetimeoffset_year_component(bool isAsync) => null;

// Skip for SQLite. Issue #14935. Cannot eval 'where ([m].Timeline >= x)'
public override Task DateTimeOffset_Contains_Less_than_Greater_than(bool isAsync) => null;
}
}