Exemplo n.º 1
0
        public async Task update_response_ok_when_create_the_feature()
        {
            var product = Builders.Product()
                          .WithName("product#1")
                          .Build();

            var feature = Builders.Feature()
                          .WithName("feature1")
                          .WithEnabled(false)
                          .Build();

            product.Features.Add(feature);

            await _fixture.Given
            .AddProduct(product);

            var updateFlagRequest = new UpdateFlagRequest()
            {
                Name        = "feature#1",
                Description = "description",
                Enabled     = true,
                FlagId      = feature.Id
            };

            var response = await _fixture.TestServer
                           .CreateRequest(ApiDefinitions.V1.Flags.Update())
                           .WithIdentity(Builders.Identity().WithDefaultClaims().Build())
                           .PutAsJsonAsync(updateFlagRequest);

            response.StatusCode
            .Should()
            .Be(StatusCodes.Status200OK);
        }
Exemplo n.º 2
0
        public async Task update_response_badrequest_if_description_is_greater_than_2000()
        {
            var updateFlagRequest = new UpdateFlagRequest()
            {
                Name        = "name",
                Description = new string('c', 2001),
                Enabled     = true,
                FlagId      = 1
            };

            var response = await _fixture.TestServer
                           .CreateRequest(ApiDefinitions.V1.Flags.Update())
                           .WithIdentity(Builders.Identity().WithDefaultClaims().Build())
                           .PutAsJsonAsync(updateFlagRequest);

            response.StatusCode
            .Should()
            .Be(StatusCodes.Status400BadRequest);
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Update(UpdateFlagRequest updateFlagRequest, CancellationToken cancellationToken = default)
        {
            await _mediator.Send(updateFlagRequest, cancellationToken);

            return(Ok());
        }