Ejemplo n.º 1
0
        public void ThenTheResultIsAsExpectedForARangeWithOnlyEndDate()
        {
            var query = new SpecialOwnerQuery
            {
                CreationDateRange = new DateRange(null, new DateTime(2020, 04, 29))
            };

            var actual = _sut.Query(query);

            AssertResult(_specialOwners, 5, actual);
        }
Ejemplo n.º 2
0
        public void ThenTheResultIsAsExpectedForARangeWithBothStartAndEndDate()
        {
            var query = new SpecialOwnerQuery
            {
                CreationDateRange = new DateRange(new DateTime(2020, 04, 26), new DateTime(2020, 04, 28))
            };

            var actual = _sut.Query(query);

            AssertResult(_specialOwners, 3, actual);
        }
        public void ThenTheResultIsAsExpected()
        {
            var query = new SpecialOwnerQuery {
                CreatedBy = "user1"
            };
            var pageInfo = new PageInfo(
                2,
                2,
                new OrderBy(SpecialOwnerRepository.CREATED_BY_COLUMN, Order.DESCENDING));
            var actual = _sut.PagedQuery(pageInfo, query);

            // Simulate the paging on the in-memory collection.
            var expected = _specialOwners.OrderByDescending(x => x.CreatedBy).Skip(2).Take(2).ToList();

            Assert.AreEqual(pageInfo, actual.PageInfo);
            Assert.AreEqual(5, actual.TotalCount);
            Assert.AreEqual(2, actual.Result.Count());
            foreach (var item in expected)
            {
                var actualDto = actual.Result.Single(x => x.Id == item.Id);
                Assert.AreEqual(item, actualDto);
            }
        }