Skip to content

Commit

Permalink
Updates based on feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajcvickers committed Sep 17, 2021
1 parent 8928b8e commit 4dcd109
Show file tree
Hide file tree
Showing 3 changed files with 155 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,44 +31,64 @@ into g
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_doesnt_produce_a_groupby_statement(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_doesnt_produce_a_groupby_statement(bool async)
{
await base.Grouping_by_all_columns_doesnt_produce_a_groupby_statement(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_2(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_2(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_2(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_3(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_3(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_3(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_4(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_4(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_4(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_5(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_5(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_5(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_6(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_6(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_6(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_7(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_7(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_7(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_8(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_8(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_8(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_9(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_9(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_9(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_10(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_10(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_10(async);
}

public class Ef6GroupByInMemoryFixture : Ef6GroupByFixtureBase
{
Expand Down
85 changes: 63 additions & 22 deletions test/EFCore.Specification.Tests/Query/Ef6GroupByTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ into g
});
}

[ConditionalTheory (Skip = "Issue #18923")]
[ConditionalTheory (Skip = "Issue #23206")]
[MemberData(nameof(IsAsyncData))]
public virtual Task Min_Elements_from_LINQ_101(bool async)
{
Expand Down Expand Up @@ -439,7 +439,7 @@ into g
});
}

[ConditionalTheory (Skip = "Issue #18923")]
[ConditionalTheory (Skip = "Issue #23206")]
[MemberData(nameof(IsAsyncData))]
public virtual Task Max_Elements_from_LINQ_101(bool async)
{
Expand Down Expand Up @@ -534,7 +534,7 @@ public virtual Task Left_Outer_Join_with_Group_Join_from_LINQ_101(bool async)
{
return AssertQuery(
async,
ss => from c in ss.Set<CustomerForLinq>()
ss => from c in ss.Set<CustomerForLinq>().Include(e => e.Orders)
join o in ss.Set<OrderForLinq>() on c equals o.Customer into ps
from o in ps.DefaultIfEmpty()
select new
Expand All @@ -554,11 +554,9 @@ from o in ps.DefaultIfEmpty()
(l, r) =>
{
Assert.Equal(l.OrderId, r.OrderId);
Assert.Equal(l.Customer.Id, r.Customer.Id);
Assert.Equal(l.Customer.Region, r.Customer.Region);
Assert.Equal(l.Customer.CompanyName, r.Customer.CompanyName);
AssertEqual(l.Customer, r.Customer);
},
entryCount: 4);
entryCount: 11);
}

protected ArubaContext CreateContext()
Expand All @@ -570,7 +568,8 @@ protected virtual void ClearLog()

public abstract class Ef6GroupByFixtureBase : SharedStoreFixtureBase<ArubaContext>, IQueryFixtureBase
{
protected override string StoreName { get; } = "Ef6GroupByTest";
protected override string StoreName
=> "Ef6GroupByTest";

public Func<DbContext> GetContextCreator()
=> () => CreateContext();
Expand Down Expand Up @@ -606,10 +605,48 @@ public virtual ISetSource GetExpectedData()
=> new ArubaData();

public IReadOnlyDictionary<Type, object> GetEntitySorters()
=> new Dictionary<Type, object>();
=> new Dictionary<Type, Func<object, object>>
{
{ typeof(CustomerForLinq), e => ((CustomerForLinq)e)?.Id },
{ typeof(OrderForLinq), e => ((OrderForLinq)e)?.Id },
}.ToDictionary(e => e.Key, e => (object)e.Value);

public IReadOnlyDictionary<Type, object> GetEntityAsserters()
=> new Dictionary<Type, object>();
=> new Dictionary<Type, Action<object, object>>
{
{
typeof(CustomerForLinq), (e, a) =>
{
Assert.Equal(e == null, a == null);
if (a != null)
{
var ee = (CustomerForLinq)e;
var aa = (CustomerForLinq)a;
Assert.Equal(ee.Id, aa.Id);
Assert.Equal(ee.Region, aa.Region);
Assert.Equal(ee.CompanyName, aa.CompanyName);
}
}
},
{
typeof(OrderForLinq), (e, a) =>
{
Assert.Equal(e == null, a == null);
if (a != null)
{
var ee = (OrderForLinq)e;
var aa = (OrderForLinq)a;
Assert.Equal(ee.Id, aa.Id);
Assert.Equal(ee.Total, aa.Total);
Assert.Equal(ee.OrderDate, aa.OrderDate);
}
}
}
}.ToDictionary(e => e.Key, e => (object)e.Value);
}

public class ArubaContext : PoolableDbContext
Expand All @@ -630,10 +667,6 @@ public class ArubaOwner

public class NumberForLinq
{
public NumberForLinq()
{
}

public NumberForLinq(int value, string name)
{
Value = value;
Expand Down Expand Up @@ -663,7 +696,7 @@ public class CustomerForLinq
public int Id { get; set; }
public string Region { get; set; }
public string CompanyName { get; set; }
public ICollection<OrderForLinq> Orders { get; set; }
public ICollection<OrderForLinq> Orders { get; } = new List<OrderForLinq>();
}

public class OrderForLinq
Expand Down Expand Up @@ -692,11 +725,11 @@ public ArubaData(ArubaContext context = null)

if (context != null)
{
context.AddRange(ArubaOwners = CreateArubaOwners());
context.AddRange(NumbersForLinq = CreateNumbersForLinq());
context.AddRange(ProductsForLinq = CreateProductsForLinq());
context.AddRange(CustomersForLinq = CreateCustomersForLinq());
context.AddRange(OrdersForLinq = CreateOrdersForLinq(CustomersForLinq));
context.AddRange(ArubaOwners);
context.AddRange(NumbersForLinq);
context.AddRange(ProductsForLinq);
context.AddRange(CustomersForLinq);
context.AddRange(OrdersForLinq);
context.SaveChanges();
}
}
Expand Down Expand Up @@ -928,9 +961,9 @@ private static IReadOnlyList<CustomerForLinq> CreateCustomersForLinq()
}
};


private static IReadOnlyList<OrderForLinq> CreateOrdersForLinq(IReadOnlyList<CustomerForLinq> customers)
=> new List<OrderForLinq>
{
var orders = new List<OrderForLinq>
{
new()
{
Expand Down Expand Up @@ -983,6 +1016,14 @@ private static IReadOnlyList<OrderForLinq> CreateOrdersForLinq(IReadOnlyList<Cus
},
};

foreach (var order in orders)
{
order.Customer.Orders.Add(order);
}

return orders;
}

private static ArubaOwner[] CreateArubaOwners()
{
var owners = new ArubaOwner[10];
Expand Down
78 changes: 52 additions & 26 deletions test/EFCore.Sqlite.FunctionalTests/Query/Ef6GroupBySqliteTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,82 @@ public Ef6GroupBySqliteTest(Ef6GroupBySqliteFixture fixture, ITestOutputHelper t
}

[ConditionalTheory (Skip = "Issue #19635")]
public override Task Average_Grouped_from_LINQ_101(bool async)
=> Task.CompletedTask;
public override async Task Average_Grouped_from_LINQ_101(bool async)
{
await base.Average_Grouped_from_LINQ_101(async);
}

[ConditionalTheory (Skip = "Issue #19635")]
public override Task Max_Grouped_from_LINQ_101(bool async)
=> Task.CompletedTask;
public override async Task Max_Grouped_from_LINQ_101(bool async)
{
await base.Max_Grouped_from_LINQ_101(async);
}

[ConditionalTheory (Skip = "Issue #19635")]
public override Task Min_Grouped_from_LINQ_101(bool async)
=> Task.CompletedTask;
public override async Task Min_Grouped_from_LINQ_101(bool async)
{
await base.Min_Grouped_from_LINQ_101(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_doesnt_produce_a_groupby_statement(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_doesnt_produce_a_groupby_statement(bool async)
{
await base.Grouping_by_all_columns_doesnt_produce_a_groupby_statement(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_2(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_2(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_2(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_3(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_3(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_3(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_4(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_4(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_4(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_5(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_5(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_5(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_6(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_6(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_6(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_7(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_7(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_7(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_8(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_8(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_8(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_9(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_9(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_9(async);
}

[ConditionalTheory (Skip = "Issue #17653")]
public override Task Grouping_by_all_columns_with_aggregate_function_works_10(bool async)
=> Task.CompletedTask;
public override async Task Grouping_by_all_columns_with_aggregate_function_works_10(bool async)
{
await base.Grouping_by_all_columns_with_aggregate_function_works_10(async);
}

public class Ef6GroupBySqliteFixture : Ef6GroupByFixtureBase
{
Expand Down

0 comments on commit 4dcd109

Please sign in to comment.