Update the base Gears of War to be synced with .Net RC1

pull/144/head
Christopher Jolly 2 years ago
parent 0211d16ea1
commit 352734a537

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>

@ -202,63 +202,63 @@ public class GearsOfWarData : ISetSource
{
Id = 1,
Name = "Marcus' Lancer",
AmmunitionType = global::EFCore.Jet.CustomBaseTests.GearsOfWarModel.AmmunitionType.Cartridge,
AmmunitionType = AmmunitionType.Cartridge,
IsAutomatic = true
},
new()
{
Id = 2,
Name = "Marcus' Gnasher",
AmmunitionType = global::EFCore.Jet.CustomBaseTests.GearsOfWarModel.AmmunitionType.Shell,
AmmunitionType = AmmunitionType.Shell,
IsAutomatic = false
},
new()
{
Id = 3,
Name = "Dom's Hammerburst",
AmmunitionType = global::EFCore.Jet.CustomBaseTests.GearsOfWarModel.AmmunitionType.Cartridge,
AmmunitionType = AmmunitionType.Cartridge,
IsAutomatic = false
},
new()
{
Id = 4,
Name = "Dom's Gnasher",
AmmunitionType = global::EFCore.Jet.CustomBaseTests.GearsOfWarModel.AmmunitionType.Shell,
AmmunitionType = AmmunitionType.Shell,
IsAutomatic = false
},
new()
{
Id = 5,
Name = "Cole's Gnasher",
AmmunitionType = global::EFCore.Jet.CustomBaseTests.GearsOfWarModel.AmmunitionType.Shell,
AmmunitionType = AmmunitionType.Shell,
IsAutomatic = false
},
new()
{
Id = 6,
Name = "Cole's Mulcher",
AmmunitionType = global::EFCore.Jet.CustomBaseTests.GearsOfWarModel.AmmunitionType.Cartridge,
AmmunitionType = AmmunitionType.Cartridge,
IsAutomatic = true
},
new()
{
Id = 7,
Name = "Baird's Lancer",
AmmunitionType = global::EFCore.Jet.CustomBaseTests.GearsOfWarModel.AmmunitionType.Cartridge,
AmmunitionType = AmmunitionType.Cartridge,
IsAutomatic = true
},
new()
{
Id = 8,
Name = "Baird's Gnasher",
AmmunitionType = global::EFCore.Jet.CustomBaseTests.GearsOfWarModel.AmmunitionType.Shell,
AmmunitionType = AmmunitionType.Shell,
IsAutomatic = false
},
new()
{
Id = 9,
Name = "Paduk's Markza",
AmmunitionType = global::EFCore.Jet.CustomBaseTests.GearsOfWarModel.AmmunitionType.Cartridge,
AmmunitionType = AmmunitionType.Cartridge,
IsAutomatic = false
},
new()

@ -43,7 +43,7 @@ public abstract class GearsOfWarFromSqlQueryTestBase<TFixture> : IClassFixture<T
private FormattableString NormalizeDelimitersInInterpolatedString(FormattableString sql)
=> Fixture.TestStore.NormalizeDelimitersInInterpolatedString(sql);
protected GearsOfWarModel.GearsOfWarContext CreateContext()
protected GearsOfWarContext CreateContext()
=> Fixture.CreateContext();
protected virtual void ClearLog()

@ -45,34 +45,6 @@ public abstract class GearsOfWarQueryTestBase<TFixture> : QueryTestBase<TFixture
=> new ExpectedQueryRewritingVisitor(Fixture.GetShadowPropertyMappings())
.Visit(expectedQueryExpression);
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Negate_on_binary_expression(bool async)
=> AssertQuery(
async,
ss => ss.Set<Squad>().Where(s => s.Id == -(s.Id + s.Id)));
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Negate_on_column(bool async)
=> AssertQuery(
async,
ss => ss.Set<Squad>().Where(s => s.Id == -s.Id));
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Double_negate_on_column(bool async)
=> AssertQuery(
async,
ss => ss.Set<Squad>().Where(s => -(-s.Id) == s.Id));
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Negate_on_like_expression(bool async)
=> AssertQuery(
async,
ss => ss.Set<Squad>().Where(s => !s.Name.StartsWith("us")));
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Entity_equality_empty(bool async)
@ -106,6 +78,13 @@ public abstract class GearsOfWarQueryTestBase<TFixture> : QueryTestBase<TFixture
Assert.Equal(e.B.ToLower(), a.B.ToLower());
});
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task ToString_string_property_projection(bool async)
=> AssertQuery(
async,
ss => ss.Set<Weapon>().Select(w => w.Name.ToString()));
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task ToString_boolean_property_non_nullable(bool async)
@ -2647,7 +2626,7 @@ public abstract class GearsOfWarQueryTestBase<TFixture> : QueryTestBase<TFixture
=> weapons.OrderBy(w => w.Id).FirstOrDefault();
private static IEnumerable<Gear> Veterans(IEnumerable<Gear> gears)
=> gears.Where(g => g.Nickname == "Marcus" || g.Nickname == "Dom" || g.Nickname == "Cole Train" || g.Nickname == "Baird");
=> gears.Where(g => g.Nickname is "Marcus" or "Dom" or "Cole Train" or "Baird");
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
@ -8186,6 +8165,104 @@ public abstract class GearsOfWarQueryTestBase<TFixture> : QueryTestBase<TFixture
async,
ss => ss.Set<Gear>().Where(s => s.Weapons.OrderBy(e => e.Name).FirstOrDefault() == null));
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task ElementAt_basic_with_OrderBy(bool async)
=> AssertElementAt(
async,
ss => ss.Set<Gear>().OrderBy(g => g.FullName),
() => 0);
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task ElementAtOrDefault_basic_with_OrderBy(bool async)
=> AssertElementAtOrDefault(
async,
ss => ss.Set<Gear>().OrderBy(g => g.FullName),
() => 1);
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task ElementAtOrDefault_basic_with_OrderBy_parameter(bool async)
{
var prm = 2;
return AssertElementAtOrDefault(
async,
ss => ss.Set<Gear>().OrderBy(g => g.FullName),
() => prm);
}
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Where_subquery_with_ElementAtOrDefault_equality_to_null_with_composite_key(bool async)
=> AssertQuery(
async,
ss => ss.Set<Squad>().Where(s => s.Members.OrderBy(e => e.Nickname).ElementAtOrDefault(2) == null));
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Where_subquery_with_ElementAt_using_column_as_index(bool async)
=> AssertQuery(
async,
ss => ss.Set<Squad>().Where(s => s.Members.OrderBy(m => m.Nickname).ElementAt(s.Id).Nickname == "Cole Train"),
ss => ss.Set<Squad>().Where(s => s.Members.OrderBy(m => m.Nickname).ElementAtOrDefault(s.Id).Nickname == "Cole Train"));
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Using_indexer_on_byte_array_and_string_in_projection(bool async)
=> AssertQuery(
async,
ss => ss.Set<Squad>().Select(x => new { x.Id, ByteArray = x.Banner[0], String = x.Name[1] }),
elementSorter: e => e.Id,
elementAsserter: (e, a) =>
{
Assert.Equal(e.Id, a.Id);
Assert.Equal(e.ByteArray, a.ByteArray);
Assert.Equal(e.String, a.String);
});
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task DateTimeOffset_to_unix_time_milliseconds(bool async)
{
long unixEpochMilliseconds = DateTimeOffset.UnixEpoch.ToUnixTimeMilliseconds();
return AssertQuery(
async,
ss => ss.Set<Gear>()
.Include(g => g.Squad.Missions)
.Where(s => s.Squad.Missions
.Where(m => unixEpochMilliseconds == m.Mission.Timeline.ToUnixTimeMilliseconds())
.FirstOrDefault() == null));
}
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task DateTimeOffset_to_unix_time_seconds(bool async)
{
long unixEpochSeconds = DateTimeOffset.UnixEpoch.ToUnixTimeSeconds();
return AssertQuery(
async,
ss => ss.Set<Gear>()
.Include(g => g.Squad.Missions)
.Where(s => s.Squad.Missions
.Where(m => unixEpochSeconds == m.Mission.Timeline.ToUnixTimeSeconds())
.FirstOrDefault() == null));
}
[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Set_operator_with_navigation_in_projection_groupby_aggregate(bool async)
=> AssertQuery(
async,
ss => ss.Set<Gear>()
.Where(x => ss.Set<Gear>().Concat(ss.Set<Gear>()).Select(x => x.Nickname).Contains("Marcus"))
.Select(x => new { x.Squad.Name, x.CityOfBirth.Location })
.GroupBy(x => new { x.Name })
.Select(x => new { x.Key.Name, SumOfLengths = x.Sum(xx => xx.Location.Length) }));
protected GearsOfWarContext CreateContext()
=> Fixture.CreateContext();

Loading…
Cancel
Save