Skip to content

Commit b32f2a7

Browse files
committed
test: join with projection
1 parent 23c10b0 commit b32f2a7

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

tests/QueryableValues.SqlServer.Tests/Integration/ComplexTypeTests.cs

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ orderby td.Id
897897
Assert.Equal(2, actual[0].ChildEntity.Count);
898898

899899
Assert.Equal(3, actual[1].Id);
900-
Assert.Equal(1, actual[1].ChildEntity.Count);
900+
Assert.Single(actual[1].ChildEntity);
901901
}
902902

903903
[Fact]
@@ -920,7 +920,7 @@ orderby td.Id
920920
Assert.Single(actual);
921921

922922
Assert.Equal(3, actual[0].Id);
923-
Assert.Equal(1, actual[0].ChildEntity.Count);
923+
Assert.Single(actual[0].ChildEntity);
924924
}
925925

926926
[Fact]
@@ -945,6 +945,33 @@ orderby td.Id
945945
Assert.Equal(1, actual[0].Id);
946946
Assert.Equal(2, actual[0].ChildEntity.Count);
947947
}
948+
949+
[Fact]
950+
public async Task JoinWithProjection()
951+
{
952+
var values = new[]
953+
{
954+
new { Id = 1, Value = Guid.Empty },
955+
new { Id = 3, Value = Guid.Parse("f6379213-750f-42df-91b9-73756f28c4b6") }
956+
};
957+
958+
var expected = new[] { 1, 3 };
959+
960+
var query =
961+
from td in _db.TestData
962+
join v in _db.AsQueryableValues(values) on new { td.Id, Value = td.GuidValue } equals new { v.Id, v.Value }
963+
select td.Id;
964+
965+
var query2 =
966+
from td in _db.TestData
967+
join v in query on td.Id equals v
968+
orderby td.Id
969+
select td.Id;
970+
971+
var actual = await query2.ToListAsync();
972+
973+
Assert.Equal(expected, actual);
974+
}
948975
}
949976

950977
[Collection("DbContext")]

tests/QueryableValues.SqlServer.Tests/Integration/SimpleTypeTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,27 @@ public async Task MustMatchSequenceOfGuid()
362362
Assert.Equal(expected, actual);
363363
}
364364

365+
[Fact]
366+
public async Task JoinWithProjection()
367+
{
368+
var values = new[] { 1, 3 };
369+
370+
var query =
371+
from td in _db.TestData
372+
join v in _db.AsQueryableValues(values) on td.Id equals v
373+
select td.Id;
374+
375+
var query2 =
376+
from td in _db.TestData
377+
join v in query on td.Id equals v
378+
orderby td.Id
379+
select td.Id;
380+
381+
var actual = await query2.ToListAsync();
382+
383+
Assert.Equal(values, actual);
384+
}
385+
365386
enum ByteEnum : byte
366387
{
367388
None,

0 commit comments

Comments
 (0)