public async Task ShouldUpdateValidationValid() { var request = new UpdateBrowserBasedMobileFirstViewModel { MobileFirstDesign = "Yes" }; var result = (await _browserMobileFirstController.UpdateMobileFirstAsync(SolutionId, request).ConfigureAwait(false)) as NoContentResult; result.StatusCode.Should().Be((int)HttpStatusCode.NoContent); _mockMediator.Verify(x => x.Send( It.Is <UpdateSolutionBrowserMobileFirstCommand>(c => c.MobileFirstDesign == "Yes" && c.SolutionId == SolutionId), It.IsAny <CancellationToken>()), Times.Once); }
public async Task ShouldUpdateValidationValid() { var request = new UpdateBrowserBasedMobileFirstViewModel { MobileFirstDesign = "Yes" }; var result = await browserMobileFirstController.UpdateMobileFirstAsync(SolutionId, request) as NoContentResult; Expression <Func <UpdateSolutionBrowserMobileFirstCommand, bool> > match = c => c.MobileFirstDesign == "Yes" && c.SolutionId == SolutionId; Assert.NotNull(result); result.StatusCode.Should().Be(StatusCodes.Status204NoContent); mockMediator.Verify(m => m.Send(It.Is(match), It.IsAny <CancellationToken>())); }
public async Task ShouldUpdateValidationValid() { var viewModel = new UpdateSolutionBrowserMobileFirstViewModel(); var validationResult = new RequiredResult(); _mockMediator .Setup(m => m.Send( It.Is <UpdateSolutionBrowserMobileFirstCommand>(q => q.SolutionId == SolutionId && q.UpdateSolutionBrowserMobileFirstViewModel == viewModel), It.IsAny <CancellationToken>())).ReturnsAsync(validationResult); var result = await _browserMobileFirstController.UpdateMobileFirstAsync(SolutionId, viewModel).ConfigureAwait(false) as NoContentResult; result?.StatusCode.Should().Be((int)HttpStatusCode.NoContent); _mockMediator.Verify( m => m.Send( It.Is <UpdateSolutionBrowserMobileFirstCommand>(q => q.SolutionId == SolutionId && q.UpdateSolutionBrowserMobileFirstViewModel == viewModel), It.IsAny <CancellationToken>()), Times.Once); }