示例#1
0
        public async Task ShouldUpdateValidationValid()
        {
            var request = new UpdateBrowserBasedPluginsViewModel
            {
                Required = "yes",
                AdditionalInformation = "Some info",
            };

            await plugInsController.UpdatePlugInsAsync(SolutionId, request);

            mockMediator.Verify(m => m.Send(
                                    It.Is <UpdateSolutionPluginsCommand>(c => c.SolutionId == SolutionId && c.Data == request),
                                    It.IsAny <CancellationToken>()));
        }
示例#2
0
        public async Task ShouldUpdateValidationValid()
        {
            var request = new UpdateBrowserBasedPluginsViewModel()
            {
                Required = "yes",
                AdditionalInformation = "Some info"
            };

            var result = (await _plugInsController.UpdatePlugInsAsync(SolutionId, request).ConfigureAwait(false)) as NoContentResult;

            _mockMediator.Verify(
                m => m.Send(
                    It.Is <UpdateSolutionPluginsCommand>(q =>
                                                         q.SolutionId == SolutionId && q.Data == request), It.IsAny <CancellationToken>()), Times.Once);
        }
示例#3
0
        public async Task ShouldUpdateValidationInvalid()
        {
            resultDictionary.Add("plugins-required", "required");
            resultDictionary.Add("plugins-detail", "maxLength");

            var request = new UpdateBrowserBasedPluginsViewModel();

            var result = await plugInsController.UpdatePlugInsAsync(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["plugins-required"].Should().Be("required");
            validationResult["plugins-detail"].Should().Be("maxLength");

            mockMediator.Verify(m => m.Send(
                                    It.Is <UpdateSolutionPluginsCommand>(c => c.SolutionId == SolutionId && c.Data == request),
                                    It.IsAny <CancellationToken>()));
        }
示例#4
0
        public async Task ShouldUpdateValidationInvalid()
        {
            _resultDictionary.Add("plugins-required", "required");
            _resultDictionary.Add("plugins-detail", "maxLength");

            var request = new UpdateBrowserBasedPluginsViewModel();

            var result =
                (await _plugInsController.UpdatePlugInsAsync(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["plugins-required"].Should().Be("required");
            validationResult["plugins-detail"].Should().Be("maxLength");

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