Esempio n. 1
0
        public async Task MilestoneRepository_GetAllPagedAsync_ReturnsAllResultsPaged()
        {
            var page = 1;
            var size = 1;

            await using var context = new TimeTrackingDbContext(_dbOptions);
            var milestoneRepository = new MilestoneRepository(context);
            var expected            = MilestonesDbSet.Get()
                                      .Skip(0)
                                      .Take(size)
                                      .OrderBy(e => e.Id)
                                      .ToList();

            var actual = await milestoneRepository.GetAllPagedAsync(page, size);

            actual.EnsurePagedResult(MilestonesDbSet.Get().ToList().Count, size, page);
            var actualItems = actual.Items.ToList();

            Assert.That(actualItems.OrderBy(e => e.Id), Is.EqualTo(expected.OrderBy(e => e.Id))
                        .Using(EqualityComparers.MilestoneComparer));
        }