public async Task Index_NoParams_ResultModelIsEnumerableOfPartnerOrganizationViewModel() { // Arrange IRepository <PartnerOrganization> repository = Substitute.For <IRepository <PartnerOrganization> >(); PartnerOrganizationController controller = new PartnerOrganizationController(repository); // Act IActionResult result = await controller.Index(); // Assert ViewResult viewResult = Assert.IsType <ViewResult>(result); Assert.IsAssignableFrom <IEnumerable <PartnerOrganizationViewModel> >(viewResult.ViewData.Model); }
public async Task Index_NoParams_RepoGetHitWithNoParams() { // Arrange IRepository <PartnerOrganization> repository = Substitute.For <IRepository <PartnerOrganization> >(); PartnerOrganizationController controller = new PartnerOrganizationController(repository); // Act await controller.Index(); // Assert #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed repository.Received(1).Get(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed }