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
10 changes: 10 additions & 0 deletions QueryKit.UnitTests/FilterParsingRegressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,16 @@ public void unknown_logical_operator_throws_query_kit_parsing_exception()
act.Should().Throw<QueryKitParsingException>().WithMessage("Operator xor is not supported");
}

[Theory]
[InlineData("Age sideways")]
[InlineData("Title, Age up")]
public void invalid_sort_direction_throws_query_kit_parsing_exception(string input)
{
var act = () => SortParser.ParseSort<TestingPerson>(input);

act.Should().Throw<QueryKitParsingException>().WithMessage("Invalid direction: *");
}

private static TResult WithCulture<TResult>(string cultureName, Func<TResult> action)
{
var originalCulture = CultureInfo.CurrentCulture;
Expand Down
2 changes: 1 addition & 1 deletion QueryKit/SortParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private static SortExpressionInfo<T> CreateSortExpression<T>(string sortClause,

if (direction != Ascending && direction != Descending)
{
throw new ArgumentException($"Invalid direction: {direction}. Allowed values are '{Ascending}' and '{Descending}'.");
throw new QueryKitParsingException($"Invalid direction: {direction}. Allowed values are '{Ascending}' and '{Descending}'.");
}

var propertyPath = config?.GetPropertyPathByQueryName(propertyName) ?? propertyName;
Expand Down
Loading