public async Task Index_GetsDataAndReturnsView() { var pagedSortedResult = new PagedSortedResult <OrganisationResultItem>() { recordsFiltered = 50, recordsTotal = 100, data = new List <OrganisationResultItem>(), }; _pagedSortedRepository.GetPagedSortedResults(0, 10, "Name", true).Returns(pagedSortedResult); var result = await _controller.Index(); Assert.IsTrue(result is ViewResult); Assert.AreEqual(pagedSortedResult.recordsTotal, ((result as ViewResult).Model as PagedSortedViewModel <OrganisationResultItem>).RecordsTotal); Assert.AreEqual(pagedSortedResult.recordsFiltered, ((result as ViewResult).Model as PagedSortedViewModel <OrganisationResultItem>).RecordsFiltered); Assert.AreSame(pagedSortedResult.data, ((result as ViewResult).Model as PagedSortedViewModel <OrganisationResultItem>).Data); }
public async Task Index_GetsDataAndReturnsView() { var pagedSortedResult = new PagedSortedResult <PartyWithRegistrationsResultItem>() { recordsFiltered = 50, recordsTotal = 100, data = new List <PartyWithRegistrationsResultItem>(), }; var services = new List <CustomService>(); _pagedSortedRepository.GetPagedSortedResults(0, 10, "Name", true).Returns(pagedSortedResult); _partyRespository.GetCustomServices().Returns(services); var result = await _controller.Index(); Assert.IsTrue(result is ViewResult); Assert.AreEqual(pagedSortedResult.recordsTotal, ((result as ViewResult).Model as HomeViewModel).RecordsTotal); Assert.AreEqual(pagedSortedResult.recordsFiltered, ((result as ViewResult).Model as HomeViewModel).RecordsFiltered); Assert.AreSame(pagedSortedResult.data, ((result as ViewResult).Model as HomeViewModel).Data); Assert.AreSame(services, ((result as ViewResult).Model as HomeViewModel).Services); }