public async Task ShouldUpdateValidationInvalid()
        {
            resultDictionary.Add("third-party-components", "maxLength");
            resultDictionary.Add("device-capabilities", "maxLength");

            var request = new UpdateNativeMobileThirdPartyViewModel();

            var result = await mobileThirdPartyController.UpdateNativeMobileThirdParty(
                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(2);
            resultValue["third-party-components"].Should().Be("maxLength");
            resultValue["device-capabilities"].Should().Be("maxLength");

            mockMediator.Verify(m => m.Send(
                It.Is<UpdateSolutionMobileThirdPartyCommand>(c => c.Id == SolutionId && c.Data == request),
                It.IsAny<CancellationToken>()));
        }
コード例 #2
0
        public async Task ShouldUpdateValidationValid()
        {
            var request = new UpdateNativeMobileThirdPartyViewModel();
            var result  = await _mobileThirdPartyController.UpdateNativeMobileThirdParty(SolutionId, request)
                          .ConfigureAwait(false) as NoContentResult;

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

            _mockMediator.Verify(
                m => m.Send(
                    It.Is <UpdateSolutionMobileThirdPartyCommand>(q => q.Id == SolutionId && q.Data == request),
                    It.IsAny <CancellationToken>()), Times.Once);
        }
        public async Task ShouldUpdateValidationValid()
        {
            var request = new UpdateNativeMobileThirdPartyViewModel();

            var result = await mobileThirdPartyController.UpdateNativeMobileThirdParty(
                SolutionId,
                request) as NoContentResult;

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

            mockMediator.Verify(m => m.Send(
                It.Is<UpdateSolutionMobileThirdPartyCommand>(c => c.Id == SolutionId && c.Data == request),
                It.IsAny<CancellationToken>()));
        }
コード例 #4
0
        public async Task ShouldUpdateValidationInvalid()
        {
            _resultDictionary.Add("third-party-components", "maxLength");
            _resultDictionary.Add("device-capabilities", "maxLength");

            var request = new UpdateNativeMobileThirdPartyViewModel();
            var result  = await _mobileThirdPartyController.UpdateNativeMobileThirdParty(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(2);
            resultValue["third-party-components"].Should().Be("maxLength");
            resultValue["device-capabilities"].Should().Be("maxLength");

            _mockMediator.Verify(
                m => m.Send(
                    It.Is <UpdateSolutionMobileThirdPartyCommand>(q => q.Id == SolutionId && q.Data == request),
                    It.IsAny <CancellationToken>()), Times.Once);
        }
コード例 #5
0
 public async Task <ActionResult> UpdateNativeMobileThirdParty(
     [Required] string id,
     UpdateNativeMobileThirdPartyViewModel model) =>
 (await mediator.Send(new UpdateSolutionMobileThirdPartyCommand(id, model))).ToActionResult();
コード例 #6
0
 public async Task <ActionResult> UpdateNativeMobileThirdParty([FromRoute][Required] string id,
                                                               [FromBody][Required] UpdateNativeMobileThirdPartyViewModel viewModel) =>
 (await _mediator.Send(new UpdateSolutionMobileThirdPartyCommand(id, viewModel)).ConfigureAwait(false))
 .ToActionResult();