public async Task ShouldUpdateValidationValid()
        {
            var request = new UpdateNativeMobileConnectionDetailsViewModel();

            var result = await controller.UpdateMobileConnectionDetails(SolutionId, request) as NoContentResult;

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

            mockMediator.Verify(m => m.Send(
                                    It.Is <UpdateSolutionMobileConnectionDetailsCommand>(c => c.SolutionId == SolutionId && c.Data == request),
                                    It.IsAny <CancellationToken>()));
        }
Esempio n. 2
0
        public async Task ShouldUpdateValidationValid()
        {
            var request = new UpdateNativeMobileConnectionDetailsViewModel();

            var result =
                (await _controller.UpdateMobileConnectionDetails(SolutionId, request)
                 .ConfigureAwait(false)) as NoContentResult;

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

            _mockMediator.Verify(
                m => m.Send(
                    It.Is <UpdateSolutionMobileConnectionDetailsCommand>(q =>
                                                                         q.SolutionId == SolutionId && q.Data == request), It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task ShouldUpdateValidationInvalid()
        {
            resultDictionary.Add("connection-requirements-description", "maxLength");
            var request = new UpdateNativeMobileConnectionDetailsViewModel();

            var result = await controller.UpdateMobileConnectionDetails(SolutionId, request) as BadRequestObjectResult;

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

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

            Assert.NotNull(resultValue);
            resultValue.Count.Should().Be(1);
            resultValue["connection-requirements-description"].Should().Be("maxLength");

            mockMediator.Verify(m => m.Send(
                                    It.Is <UpdateSolutionMobileConnectionDetailsCommand>(q => q.SolutionId == SolutionId && q.Data == request),
                                    It.IsAny <CancellationToken>()));
        }
Esempio n. 4
0
        public async Task ShouldUpdateValidationInvalid()
        {
            _resultDictionary.Add("connection-requirements-description", "maxLength");
            var request = new UpdateNativeMobileConnectionDetailsViewModel();


            var result =
                (await _controller.UpdateMobileConnectionDetails(SolutionId, request).ConfigureAwait(false)) as
                BadRequestObjectResult;

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

            resultValue.Count.Should().Be(1);
            resultValue["connection-requirements-description"].Should().Be("maxLength");

            _mockMediator.Verify(
                m => m.Send(
                    It.Is <UpdateSolutionMobileConnectionDetailsCommand>(q =>
                                                                         q.SolutionId == SolutionId && q.Data ==
                                                                         request), It.IsAny <CancellationToken>()), Times.Once);
        }
Esempio n. 5
0
 public async Task <ActionResult> UpdateMobileConnectionDetails(
     [Required] string id,
     UpdateNativeMobileConnectionDetailsViewModel model) =>
 (await mediator.Send(new UpdateSolutionMobileConnectionDetailsCommand(id, model))).ToActionResult();
 public async Task <ActionResult> UpdateMobileConnectionDetails([FromRoute][Required] string id,
                                                                [FromBody][Required] UpdateNativeMobileConnectionDetailsViewModel viewModel) =>
 (await _mediator.Send(new UpdateSolutionMobileConnectionDetailsCommand(id, viewModel)).ConfigureAwait(false)).ToActionResult();