mirror of
https://github.com/Biarity/Sieve.git
synced 2025-07-26 12:13:28 +02:00
Document & test multiple values for 2.2.0. Closes #46
This commit is contained in:
@@ -172,6 +172,20 @@ namespace SieveUnitTests
|
||||
Assert.IsTrue(result.Count() == 3);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomFiltersWithOperatorsWork()
|
||||
{
|
||||
var model = new SieveModel()
|
||||
{
|
||||
Filters = "HasInTitle==A",
|
||||
};
|
||||
|
||||
var result = _processor.Apply(model, _posts);
|
||||
|
||||
Assert.IsTrue(result.Any(p => p.Id == 0));
|
||||
Assert.IsTrue(result.Count() == 1);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CustomFiltersMixedWithUsualWork1()
|
||||
{
|
||||
|
@@ -7,21 +7,28 @@ namespace SieveUnitTests.Services
|
||||
{
|
||||
public class SieveCustomFilterMethods : ISieveCustomFilterMethods
|
||||
{
|
||||
public IQueryable<Post> IsNew(IQueryable<Post> source, string op, string value)
|
||||
public IQueryable<Post> IsNew(IQueryable<Post> source, string op, string[] values)
|
||||
{
|
||||
var result = source.Where(p => p.LikeCount < 100);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IQueryable<Comment> IsNew(IQueryable<Comment> source, string op, string value)
|
||||
public IQueryable<Post> HasInTitle(IQueryable<Post> source, string op, string[] values)
|
||||
{
|
||||
var result = source.Where(p => p.Title.Contains(values[0]));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IQueryable<Comment> IsNew(IQueryable<Comment> source, string op, string[] values)
|
||||
{
|
||||
var result = source.Where(c => c.DateCreated > DateTimeOffset.UtcNow.AddDays(-2));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public IQueryable<Comment> TestComment(IQueryable<Comment> source, string op, string value)
|
||||
public IQueryable<Comment> TestComment(IQueryable<Comment> source, string op, string[] values)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
Reference in New Issue
Block a user