Пример #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);
        }
        public async Task ShouldUpdateValidationValid()
        {
            var pluginsViewModel = new UpdateSolutionPluginsViewModel();

            var validationModel = new RequiredMaxLengthResult();

            _mockMediator
            .Setup(m => m.Send(
                       It.Is <UpdateSolutionPluginsCommand>(q =>
                                                            q.SolutionId == SolutionId && q.UpdateSolutionPluginsViewModel == pluginsViewModel),
                       It.IsAny <CancellationToken>())).ReturnsAsync(validationModel);

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

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

            _mockMediator.Verify(
                m => m.Send(
                    It.Is <UpdateSolutionPluginsCommand>(q =>
                                                         q.SolutionId == SolutionId && q.UpdateSolutionPluginsViewModel ==
                                                         pluginsViewModel), It.IsAny <CancellationToken>()), Times.Once);
        }