Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
roji committed Aug 19, 2021
1 parent 8904d6a commit 5668178
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Diagnostics.Internal;
Expand Down Expand Up @@ -8997,6 +8998,15 @@ public virtual Task Include_on_entity_that_is_not_present_in_final_projection_bu
});
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Comparison_with_value_converted_subclass(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Faction>().Where(f => f.ServerAddress == IPAddress.Loopback));
}

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Net;

namespace Microsoft.EntityFrameworkCore.TestModels.GearsOfWarModel
{
public abstract class Faction
{
public int Id { get; set; }
public string Name { get; set; }
public IPAddress ServerAddress { get; set; }

public string CapitalName { get; set; }
public City Capital { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8154,6 +8154,16 @@ END AS [IsOfficer]
FROM [Gears] AS [g]");
}

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

AssertSql(
@"SELECT [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[ServerAddress], [f].[CommanderName], [f].[Eradicated]
FROM [Factions] AS [f]
WHERE [f].[ServerAddress] = CAST(N'127.0.0.1' AS nvarchar(45))");
}

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

0 comments on commit 5668178

Please sign in to comment.