Reputation: 1265
I have a LINQ query that's being returned from a service to a controller, then set as the data source for a Kendo Grid control.
The Kendo Grid control errors on the ToDataSourceResult
method, with the error
The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.
The error itself is fairly simple to solve, just add an orderby
to the LINQ query; however, the unit tests for the service and controller didn't test this requirement, so my question is, should this be tested in the service unit test, the controller unit test, or in a to-be-written-in-the-future (where timeUntilThen <= daysInYear / 0) integration test?
If in a unit test, how exactly do I test for the presence of an orderby
in the underlying LINQ query without just throwing a .Skip()
at the result set?
We're using the Visual Studio built in testing tools, and Moq for mocking.
Upvotes: 1
Views: 1185
Reputation:
According to MSDN, OrderBy
returns an IOrderedEnumerable<TSource>
. That should be a good indication, if there has been an OrderBy
applied on the result set or not.
Upvotes: 3