-
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests and restructure some tests
(#44)
- Loading branch information
Showing
3 changed files
with
441 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Linq.Dynamic.Core.Tests.Helpers.Models; | ||
using Xunit; | ||
|
||
namespace System.Linq.Dynamic.Core.Tests | ||
{ | ||
public partial class EntitiesTests | ||
{ | ||
[Fact] | ||
public void Cast_To_nullableint() | ||
{ | ||
// Arrange | ||
PopulateTestData(1, 0); | ||
|
||
// Act | ||
var expectedResult = _context.Blogs.Select(b => (int?)b.BlogId); | ||
var result = _context.Blogs.AsQueryable().Select("int?(BlogId)"); | ||
|
||
// Assert | ||
Assert.Equal(expectedResult.ToArray(), result.ToDynamicArray<int?>()); | ||
} | ||
|
||
[Fact] | ||
public void Cast_To_newnullableint() | ||
{ | ||
// Arrange | ||
PopulateTestData(1, 0); | ||
|
||
// Act | ||
var expectedResult = _context.Blogs.Select(x => new { i = (int?)x.BlogId }); | ||
var result = _context.Blogs.AsQueryable().Select("new (int?(BlogId) as i)"); | ||
|
||
//Assert | ||
Assert.Equal(expectedResult.Count(), result.Count()); | ||
} | ||
} | ||
} |
Oops, something went wrong.