public void FilterWithAnd()
        {
            var query = new PersonPageQuery();
            query.AddFiltering(p => p.Address.City, "n", CriterionPredicate.EndsWith);
            query.AddFiltering(p => p.Name, "a", CriterionPredicate.StartsWith, ignoreCase: true);

            var page = _handler.Handle(query);

            Assert.IsNotNull(page);
            Assert.AreEqual(1, page.Data.Count);
            CollectionAssert.AreEquivalent(new[] { "Amily" }, page.Data.Select(p => p.Name).ToArray());
        }
        public void FilterWithAnd()
        {
            var query = new PersonPageQuery();

            query.AddFiltering(p => p.Address.City, "n", CriterionPredicate.EndsWith);
            query.AddFiltering(p => p.Name, "a", CriterionPredicate.StartsWith, ignoreCase: true);

            var page = _handler.Handle(query);

            Assert.IsNotNull(page);
            Assert.AreEqual(1, page.Data.Count);
            CollectionAssert.AreEquivalent(new[] { "Amily" }, page.Data.Select(p => p.Name).ToArray());
        }
        public void FilterWithOr()
        {
            var query = new PersonPageQuery();
            query.AddFiltering(p => p.Address.City, "n", CriterionPredicate.EndsWith);
            query.AddFiltering(p => p.Name, "i", CriterionPredicate.StartsWith, ignoreCase: true);
            query.Filtering.CombiningRule = FilteringCollection.CombiningFilters.Or;

            var page = _handler.Handle(query);

            Assert.IsNotNull(page);
            Assert.AreEqual(3, page.Data.Count);
            CollectionAssert.AreEquivalent(new[] { "Amily", "Jim", "Ivan" }, page.Data.Select(p => p.Name).ToArray());
        }
        public void FilterWithOr()
        {
            var query = new PersonPageQuery();

            query.AddFiltering(p => p.Address.City, "n", CriterionPredicate.EndsWith);
            query.AddFiltering(p => p.Name, "i", CriterionPredicate.StartsWith, ignoreCase: true);
            query.Filtering.CombiningRule = FilteringCollection.CombiningFilters.Or;

            var page = _handler.Handle(query);

            Assert.IsNotNull(page);
            Assert.AreEqual(3, page.Data.Count);
            CollectionAssert.AreEquivalent(new[] { "Amily", "Jim", "Ivan" }, page.Data.Select(p => p.Name).ToArray());
        }
        public void FilterByChainOfProperties()
        {
            var query = new PersonPageQuery();
            query.AddFiltering(p => p.Address.City, "n", CriterionPredicate.EndsWith);

            var page = _handler.Handle(query);

            Assert.IsNotNull(page);
            Assert.AreEqual(2, page.Data.Count);
            CollectionAssert.AreEquivalent(new[] { "Amily", "Jim" }, page.Data.Select(p => p.Name).ToArray());
        }
        public void FilterByChainOfProperties()
        {
            var query = new PersonPageQuery();

            query.AddFiltering(p => p.Address.City, "n", CriterionPredicate.EndsWith);

            var page = _handler.Handle(query);

            Assert.IsNotNull(page);
            Assert.AreEqual(2, page.Data.Count);
            CollectionAssert.AreEquivalent(new[] { "Amily", "Jim" }, page.Data.Select(p => p.Name).ToArray());
        }