public async Task ThenTheMediatorIsCalled() { _mockMediator.Setup(x => x.SendAsync(It.IsAny <GetStatisticsRequest>())) .ReturnsAsync(new GetStatisticsResponse()); await _controller.GetStatistics(); _mockMediator.Verify(x => x.SendAsync(It.IsAny <GetStatisticsRequest>())); }
public async Task ThenShouldReturnStatistics() { var result = await _controller.GetStatistics() as OkNegotiatedContentResult <Statistics>; Assert.That(result, Is.Not.Null); Assert.That(result.Content, Is.SameAs(_statistics)); }
public async Task ThenShouldReturnOkNegotiatedContentResultWithStatistics() { var result = await _controller.GetStatistics(); result.Should().NotBeNull(); result.Should().BeOfType <OkNegotiatedContentResult <StatisticsViewModel> >(); var okResult = (OkNegotiatedContentResult <StatisticsViewModel>)result; okResult.Content.Should().NotBeNull(); okResult.Content.ShouldBeEquivalentTo(_statisticsViewModel); }