Пример #1
0
        public async Task ShouldUpdateValidationInvalid()
        {
            resultDictionary.Add("operating-systems-description", "maxLength");
            resultDictionary.Add("operating-systems", "required");

            var request = new UpdateNativeMobileOperatingSystemsViewModel();

            var result = await mobileOperatingSystemsController.UpdateMobileOperatingSystems(
                SolutionId,
                request) as BadRequestObjectResult;

            Assert.NotNull(result);
            result.StatusCode.Should().Be(StatusCodes.Status400BadRequest);

            var validationResult = result.Value as Dictionary <string, string>;

            Assert.NotNull(validationResult);
            validationResult.Count.Should().Be(2);
            validationResult["operating-systems"].Should().Be("required");
            validationResult["operating-systems-description"].Should().Be("maxLength");

            mockMediator.Verify(m => m.Send(
                                    It.Is <UpdateSolutionMobileOperatingSystemsCommand>(c => c.Id == SolutionId && c.Data == request),
                                    It.IsAny <CancellationToken>()));
        }
Пример #2
0
        public async Task ShouldUpdateValidationValid()
        {
            var request = new UpdateNativeMobileOperatingSystemsViewModel();

            var result = await mobileOperatingSystemsController.UpdateMobileOperatingSystems(
                SolutionId,
                request) as NoContentResult;

            Assert.NotNull(result);
            result.StatusCode.Should().Be(StatusCodes.Status204NoContent);

            mockMediator.Verify(m => m.Send(
                                    It.Is <UpdateSolutionMobileOperatingSystemsCommand>(c => c.Id == SolutionId && c.Data == request),
                                    It.IsAny <CancellationToken>()));
        }
        public async Task ShouldUpdateValidationValid()
        {
            var request = new UpdateNativeMobileOperatingSystemsViewModel();

            var result =
                (await _mobileOperatingSystemsController.UpdateMobileOperatingSystems(SolutionId, request)
                 .ConfigureAwait(false)) as NoContentResult;

            result.StatusCode.Should().Be((int)HttpStatusCode.NoContent);

            _mockMediator.Verify(
                m => m.Send(
                    It.Is <UpdateSolutionMobileOperatingSystemsCommand>(q =>
                                                                        q.Id == SolutionId && q.Data == request), It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task ShouldUpdateValidationInvalid()
        {
            _resultDictionary.Add("operating-systems-description", "maxLength");
            _resultDictionary.Add("operating-systems", "required");

            var request = new UpdateNativeMobileOperatingSystemsViewModel();

            var result = (await _mobileOperatingSystemsController.UpdateMobileOperatingSystems(SolutionId, request).ConfigureAwait(false)) as BadRequestObjectResult;

            result.StatusCode.Should().Be((int)HttpStatusCode.BadRequest);
            var validationResult = result.Value as Dictionary <string, string>;

            validationResult.Count.Should().Be(2);
            validationResult["operating-systems"].Should().Be("required");
            validationResult["operating-systems-description"].Should().Be("maxLength");

            _mockMediator.Verify(
                m => m.Send(
                    It.Is <UpdateSolutionMobileOperatingSystemsCommand>(q =>
                                                                        q.Id == SolutionId && q.Data ==
                                                                        request), It.IsAny <CancellationToken>()), Times.Once);
        }
Пример #5
0
 public async Task <ActionResult> UpdateMobileOperatingSystems([FromRoute][Required] string id,
                                                               [FromBody][Required] UpdateNativeMobileOperatingSystemsViewModel viewModel) =>
 (await _mediator.Send(new UpdateSolutionMobileOperatingSystemsCommand(id, viewModel)).ConfigureAwait(false)).ToActionResult();
 public async Task <ActionResult> UpdateMobileOperatingSystems(
     [Required] string id,
     UpdateNativeMobileOperatingSystemsViewModel model) =>
 (await mediator.Send(new UpdateSolutionMobileOperatingSystemsCommand(id, model))).ToActionResult();