Skip to content

Commit

Permalink
test that exception is thrown for different types
Browse files Browse the repository at this point in the history
  • Loading branch information
maschmi committed Apr 30, 2017
1 parent 54d264f commit 3eb203d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/System.Linq.Dynamic.Core.Tests/QueryableTests.GroupJoin.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System.Collections.Generic;
using System.Linq.Dynamic.Core.Exceptions;
using System.Linq.Dynamic.Core.Tests.Helpers.Models;
using NFluent;
using Xunit;

namespace System.Linq.Dynamic.Core.Tests
Expand Down Expand Up @@ -152,5 +154,21 @@ public void GroupJoinOnNullableType_LeftNullable()
}
}
}

[Fact]
public void GroupJoinOnNullableType_NotSameTypesThrowsException()
{
var person = new Person { Id = 1, Name = "Hedlund, Magnus" };
var people = new List<Person> { person };
var pets = new List<Pet> { new Pet { Name = "Daisy", OwnerId = person.Id } };

Check.ThatCode(() =>
people.AsQueryable()
.GroupJoin(
pets,
"it.Id",
"Name", // This is wrong
"new(outer.Name as OwnerName, inner as Pets)")).Throws<ParseException>();
}
}
}

0 comments on commit 3eb203d

Please sign in to comment.