public void GivenARequestIsNull_WhenValidating_ThenArgumentNullIsThrown()
        {
            UpdateFeatureRequest request = null;

            request
                .WhenValidating()
                .ThenExceptionIsThrown<ArgumentValidationException>();
        }
Beispiel #2
0
        public async Task <IActionResult> UpdateFeature([FromBody] UpdateFeatureRequest request)
        {
            var updateFeature = await _featureApplication.GetFeatureById(request.Id);

            if (updateFeature == null)
            {
                return(NotFound(new
                {
                    Message = "Can not find feature with Id = " + request.Id
                }));
            }

            updateFeature.IsCalculated    = request.IsCalculated;
            updateFeature.Name            = request.Name;
            updateFeature.WeightRate      = request.WeightRate;
            updateFeature.IsSearchFeature = request.IsSearchFeature;
            updateFeature = await _featureApplication.UpdateFeature(updateFeature);
            await SetUpdateScore();

            return(Ok(updateFeature));
        }
        public static void ThenCommandIsFilled(this Func<UpdateFeatureCommand> createFunc, UpdateFeatureRequest request)
        {
            var command = createFunc();

            command.Name.Should().Be(request.Name);   
            command.Path.Should().BeEquivalentTo(request.Path);
            command.NewName.Should().Be(request.NewName);   
            command.NewPath.Should().BeEquivalentTo(request.NewPath);
            command.UpdatedBy.Should().BeEquivalentTo(request.UpdatedBy);
        }
 public static Func<UpdateFeatureCommand> WhenExtractingCommand(this UpdateFeatureRequest request)
 {
     return () => request.ToUpdateFeatureCommand();
 }
 public static Action WhenValidating(this UpdateFeatureRequest request)
 {
     return () => request.Validate();
 }
Beispiel #6
0
 public static Func <Task <IActionResult> > WhenProcessingCommand(
     this UpdateFeatureController controller,
     UpdateFeatureRequest request)
 {
     return(() => controller.Post(request));
 }
Beispiel #7
0
        public async Task <IActionResult> Update(string productName, string featureName, UpdateFeatureRequest updateFeatureRequest, CancellationToken cancellationToken = default)
        {
            updateFeatureRequest.CurrentName = featureName;
            updateFeatureRequest.ProductName = productName;

            await _mediator.Send(updateFeatureRequest, cancellationToken);

            return(NoContent());
        }