Skip to content

Commit

Permalink
Test for #9742
Browse files Browse the repository at this point in the history
Resolves #9742
  • Loading branch information
AndriySvyryd committed Aug 23, 2019
1 parent 5197fa7 commit 6a66e7c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/EFCore.Relational/Query/QuerySqlGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using Microsoft.EntityFrameworkCore.Storage;

namespace Microsoft.EntityFrameworkCore.SqlServer.Query.Internal
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System;
using System.Diagnostics;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Diagnostics.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.Extensions.Logging;

Expand Down
36 changes: 35 additions & 1 deletion test/EFCore.Specification.Tests/Query/IncludeTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.TestModels.Northwind;
using Microsoft.EntityFrameworkCore.TestUtilities;
using Microsoft.EntityFrameworkCore.TestUtilities.Xunit;
using Xunit;

// ReSharper disable InconsistentNaming
Expand Down Expand Up @@ -3192,6 +3191,41 @@ var customers
}
}

[ConditionalTheory]
[InlineData(false)]
[InlineData(true)]
public virtual void Include_collection_with_multiple_conditional_order_by(bool useString)
{
using (var context = CreateContext())
{
var orders
= useString
? context.Orders
.Include("OrderDetails")
.OrderBy(o => o.OrderID > 0)
.ThenBy(o => o.Customer != null ? o.Customer.City : String.Empty)
.Take(5)
.ToList()
: context.Orders
.Include(c => c.OrderDetails)
.OrderBy(o => o.OrderID > 0)
.ThenBy(o => o.Customer != null ? o.Customer.City : String.Empty)
.Take(5)
.ToList();

foreach (var order in orders)
{
CheckIsLoaded(
context,
order,
orderDetailsLoaded: true,
productLoaded: false,
customerLoaded: false,
ordersLoaded: false);
}
}
}

[ConditionalTheory]
[InlineData(false)]
[InlineData(true)]
Expand Down

0 comments on commit 6a66e7c

Please sign in to comment.