Skip to content

Commit 3eb203d

Browse files
committed
test that exception is thrown for different types
1 parent 54d264f commit 3eb203d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

test/System.Linq.Dynamic.Core.Tests/QueryableTests.GroupJoin.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System.Collections.Generic;
2+
using System.Linq.Dynamic.Core.Exceptions;
23
using System.Linq.Dynamic.Core.Tests.Helpers.Models;
4+
using NFluent;
35
using Xunit;
46

57
namespace System.Linq.Dynamic.Core.Tests
@@ -152,5 +154,21 @@ public void GroupJoinOnNullableType_LeftNullable()
152154
}
153155
}
154156
}
157+
158+
[Fact]
159+
public void GroupJoinOnNullableType_NotSameTypesThrowsException()
160+
{
161+
var person = new Person { Id = 1, Name = "Hedlund, Magnus" };
162+
var people = new List<Person> { person };
163+
var pets = new List<Pet> { new Pet { Name = "Daisy", OwnerId = person.Id } };
164+
165+
Check.ThatCode(() =>
166+
people.AsQueryable()
167+
.GroupJoin(
168+
pets,
169+
"it.Id",
170+
"Name", // This is wrong
171+
"new(outer.Name as OwnerName, inner as Pets)")).Throws<ParseException>();
172+
}
155173
}
156174
}

0 commit comments

Comments
 (0)