コード例 #1
0
        public async Task Will_Return_Page_Of_TemplateVersions()
        {
            var templateId = _templates[0].TemplateId;

            _tenantIdProvider.Setup(x => x.TenantId).Returns(Tenant1Id).Verifiable();

            var firstPage = await _repository.GetTemplateVersionsPage(templateId, 1, 1, CancellationToken.None);

            var secondPage = await _repository.GetTemplateVersionsPage(templateId, 2, 1, CancellationToken.None);

            firstPage.TotalCount.Should().Be(2);
            secondPage.TotalCount.Should().Be(2);
            firstPage.Entities.Count.Should().Be(1);
            secondPage.Entities.Count.Should().Be(1);
            firstPage.Entities.ElementAt(0).Should().BeEquivalentTo(_templates[0].Versions.Single(x => x.Version == 2));
            secondPage.Entities.ElementAt(0).Should().BeEquivalentTo(_templates[0].Versions.Single(x => x.Version == 1));

            _tenantIdProvider.Verify();
        }