public async Task ShouldGetMobileFirst(bool?mobileFirstDesign, string response) { _mockMediator.Setup(m => m .Send(It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>())) .ReturnsAsync(Mock.Of <IClientApplication>(c => c.MobileFirstDesign == mobileFirstDesign)); var result = (await _browserMobileFirstController.GetMobileFirstAsync(SolutionId).ConfigureAwait(false)) as ObjectResult; result.StatusCode.Should().Be((int)HttpStatusCode.OK); var mobileFirst = (result.Value as GetBrowserMobileFirstResult); mobileFirst.MobileFirstDesign.Should().Be(response); _mockMediator.Verify( m => m.Send(It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>()), Times.Once); }
public async Task ShouldGetMobileFirst(bool?mobileFirstDesign, string response) { mockMediator .Setup(m => m.Send( It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>())) .ReturnsAsync(Mock.Of <IClientApplication>(c => c.MobileFirstDesign == mobileFirstDesign)); var result = await browserMobileFirstController.GetMobileFirstAsync(SolutionId) as ObjectResult; Assert.NotNull(result); result.StatusCode.Should().Be(StatusCodes.Status200OK); var mobileFirst = result.Value as GetBrowserMobileFirstResult; Assert.NotNull(mobileFirst); mobileFirst.MobileFirstDesign.Should().Be(response); mockMediator.Verify(m => m.Send( It.Is <GetClientApplicationBySolutionIdQuery>(q => q.Id == SolutionId), It.IsAny <CancellationToken>())); }