mirror of
https://github.com/Biarity/Sieve.git
synced 2025-07-27 04:33:23 +02:00
Fix test filter parameters and add new editorconfig
This commit is contained in:
@@ -6,10 +6,16 @@ namespace SieveUnitTests.Services
|
||||
{
|
||||
public class SieveCustomFilterMethods : ISieveCustomFilterMethods
|
||||
{
|
||||
public IQueryable<Post> IsNew(IQueryable<Post> source)
|
||||
=> source.Where(p => p.LikeCount < 100);
|
||||
public IQueryable<Post> IsNew(IQueryable<Post> source, string op, string value)
|
||||
{
|
||||
var result = source.Where(p => p.LikeCount < 100);
|
||||
|
||||
public IQueryable<Comment> TestComment(IQueryable<Comment> source)
|
||||
=> source;
|
||||
return result;
|
||||
}
|
||||
|
||||
public IQueryable<Comment> TestComment(IQueryable<Comment> source, string op, string value)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,10 +6,15 @@ namespace SieveUnitTests.Services
|
||||
{
|
||||
public class SieveCustomSortMethods : ISieveCustomSortMethods
|
||||
{
|
||||
public IQueryable<Post> Popularity(IQueryable<Post> source, bool useThenBy) => useThenBy
|
||||
? ((IOrderedQueryable<Post>)source).ThenBy(p => p.LikeCount)
|
||||
: source.OrderBy(p => p.LikeCount)
|
||||
public IQueryable<Post> Popularity(IQueryable<Post> source, bool useThenBy, bool desc)
|
||||
{
|
||||
var result = useThenBy ?
|
||||
((IOrderedQueryable<Post>)source).ThenBy(p => p.LikeCount) :
|
||||
source.OrderBy(p => p.LikeCount)
|
||||
.ThenBy(p => p.CommentCount)
|
||||
.ThenBy(p => p.DateCreated);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user