public async Task Then_Returns_View_With_Correct_ViewModel( IndexRequest request, IndexViewModel viewModel, string organisationsLink, string schemesLink, [Frozen] Mock <IModelMapper> mockMapper, [Frozen] Mock <ILinkGenerator> mockLinkGenerator, CohortController controller) { mockMapper .Setup(mapper => mapper.Map <IndexViewModel>(request)) .ReturnsAsync(viewModel); mockLinkGenerator .Setup(generator => generator.AccountsLink($"accounts/{request.AccountHashedId}/agreements")) .Returns(organisationsLink); mockLinkGenerator .Setup(generator => generator.AccountsLink($"accounts/{request.AccountHashedId}/schemes")) .Returns(schemesLink); var result = await controller.Index(request) as ViewResult; result.ViewName.Should().BeNull(); var model = result.Model as IndexViewModel; model.Should().BeSameAs(viewModel); }