Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions test/System.Linq.Dynamic.Core.Tests/EntitiesTests.OrderBy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,26 @@ public void Entities_OrderBy_RestrictOrderByIsTrue_InvalidExpressionShouldThrow(
// Assert
action.Should().Throw<ParseException>().WithMessage("No property or field 'IIF' exists in type 'Blog'");
}

[Fact]
public void Entities_OrderBy_NullPropagation_Int()
{
// Arrange
var resultBlogs = _context.Blogs.OrderBy(b => b.NullableInt ?? -1).ToArray();
var dynamicResultBlogs = _context.Blogs.OrderBy("np(NullableInt, -1)").ToArray();

// Assert
Assert.Equal(resultBlogs, dynamicResultBlogs);
}

[Fact]
public void Entities_OrderBy_NullPropagation_String()
{
// Arrange
var resultBlogs = _context.Blogs.OrderBy(b => b.X ?? "_").ToArray();
var dynamicResultBlogs = _context.Blogs.OrderBy("np(X, \"_\")").ToArray();

// Assert
Assert.Equal(resultBlogs, dynamicResultBlogs);
}
}
2 changes: 2 additions & 0 deletions test/System.Linq.Dynamic.Core.Tests/Helpers/Models/User.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class User

public int? NullableInt { get; set; }

public string? NullableString { get; set; }

public int Income { get; set; }

public char C { get; set; }
Expand Down
Loading
Loading