Пример #1
0
        public void AssertQuery(Func<IQueryable<Customer>, IQueryable<Customer>> func, int skip, int take, IPage<Customer> result)
        {
            var q = func(_customers.AsQueryable());

            int count = q.Count();

            result.TotalCount.Should().Be(count);
            var comp = q.Skip(skip).Take(take).ToList();

            result.TotalPages(take).Should().Be((int)Math.Ceiling((decimal)q.Count() / take));
            result.Count.Should().Be(comp.Count);

            comp.Count.Should().Be.GreaterThan(0);

            for (int i = 0; i < comp.Count; i++)
            {
                result[i].Id.Should().Be(comp[i].Id);
            }
        }