Fix test filter parameters and add new editorconfig

This commit is contained in:
Biarity
2018-05-25 18:30:44 +10:00
parent 3569d51490
commit fe71c7f392
3 changed files with 78 additions and 27 deletions

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}