예제 #1
0
        public async Task list_response_ok_and_use_skip_take_values()
        {
            var permission = Builders.Permission()
                             .WithManagementPermission()
                             .Build();

            var product = Builders.Product()
                          .WithName("fooproduct")
                          .Build();

            var feature = Builders.Feature()
                          .WithName("barfeature")
                          .Build();

            product.Features
            .Add(feature);

            //this add new history also
            await _fixture.Given
            .AddProduct(product);

            await _fixture.Given
            .AddPermission(permission);

            var history1 = Builders.History()
                           .WithFeatureName(feature.Name)
                           .WithProductName(product.Name)
                           .WithOldValues("")
                           .WithNewValues("{environments:development}")
                           .Build();

            var history2 = Builders.History()
                           .WithFeatureName(feature.Name)
                           .WithProductName(product.Name)
                           .WithOldValues("")
                           .WithNewValues("{environments:development}")
                           .Build();

            await _fixture.Given
            .AddHistory(history1, history2);

            var response = await _fixture.TestServer
                           .CreateRequest(ApiDefinitions.V5.Audit.List(pageIndex: 1, pageCount: 1))
                           .WithIdentity(Builders.Identity().WithDefaultClaims().Build())
                           .GetAsync();

            response.StatusCode
            .Should()
            .Be(HttpStatusCode.OK);

            var content = await response.Content
                          .ReadAs <PaginatedResult <ListAuditResponseDetail> >();

            content.PageIndex.Should().Be(1);
            content.Count.Should().Be(1);
            content.Total.Should().Be(4); //add feature already add new history also
        }