added test for not support.

This commit is contained in:
David Lebee 2019-10-13 14:11:57 -05:00
parent c300906c5e
commit 19858764a3
2 changed files with 32 additions and 2 deletions

View File

@ -118,6 +118,34 @@ namespace PoweredSoft.DynamicQuery.Test
});
}
[Fact]
public void SimpleFilterWithNot()
{
MockContextFactory.SeedAndTestContextFor("AsyncTests_SimpleFilter2", TestSeeders.SimpleSeedScenario, async ctx =>
{
var resultShouldMatch = ctx.Items.Where(t => !t.Name.EndsWith("Cables")).ToList();
var criteria = new QueryCriteria()
{
Filters = new List<IFilter>
{
new SimpleFilter
{
Path = "Name",
Type = FilterType.EndsWith,
Value = "Cables",
Not = true
}
}
};
var asyncService = new AsyncQueryableService(new[] { new AsyncQueryableHandlerService() });
var queryHandler = new QueryHandlerAsync(asyncService);
var result = await queryHandler.ExecuteAsync(ctx.Items, criteria);
Assert.Equal(resultShouldMatch, result.Data);
});
}
[Fact]
public void TestPaging()
{

View File

@ -140,10 +140,11 @@ namespace PoweredSoft.DynamicQuery.Test
Count++;
}
public async Task AfterReadAsync(List<Tuple<Ticket, object>> pairs, CancellationToken cancellationToken = default(CancellationToken))
public Task AfterReadAsync(List<Tuple<Ticket, object>> pairs, CancellationToken cancellationToken = default(CancellationToken))
{
Test2 = true;
Count++;
return Task.CompletedTask;
}
public void AfterReadEntity(List<Ticket> entities)
@ -152,10 +153,11 @@ namespace PoweredSoft.DynamicQuery.Test
Count++;
}
public async Task AfterReadEntityAsync(List<Ticket> entities, CancellationToken cancellationToken = default(CancellationToken))
public Task AfterReadEntityAsync(List<Ticket> entities, CancellationToken cancellationToken = default(CancellationToken))
{
Test4 = true;
Count++;
return Task.CompletedTask;
}
public object InterceptResultTo(Ticket entity)