public void ThenTheResultIsAsExpected()
        {
            var owners   = new[] { "user1", "user2", "user3", "user4", "user5" };
            var pageInfo = new PageInfo(
                2,
                2,
                new OrderBy(AssetRepository.OWNER_COLUMN, Order.DESCENDING));
            var actual = _sut.ForOwners(pageInfo, owners);

            var expected = _assets
                           .Where(x => owners.Contains(x.Owner))
                           .OrderByDescending(x => x.Owner)
                           .Skip(2)
                           .Take(2)
                           .ToList();

            Assert.AreEqual(pageInfo, actual.PageInfo);
            Assert.AreEqual(5, actual.TotalCount);
            Assert.AreEqual(2, actual.Result.Count());
            foreach (var expectedDto in expected)
            {
                var actualDto = actual.Result.Single(x => x.Id == expectedDto.Id);
                Assert.AreEqual(expectedDto, actualDto);
            }
        }
Example #2
0
        public void ThenTheResultIsAsExpected()
        {
            var owners = new[] { "user1", "user2", "user3", "user4" };
            var actual = _sut.ForOwners(owners).ToList();

            var expected = _assets.Where(x => owners.Contains(x.Owner)).ToList();

            Assert.AreEqual(4, actual.Count);
            foreach (var expectedDto in expected)
            {
                var actualDto = actual.Single(x => x.Id == expectedDto.Id);
                Assert.AreEqual(expectedDto, actualDto);
            }
        }