public ViewResult ENodebList(int townId, int page = 1) { ENodebListViewModel viewModel = new ENodebListViewModel(_eNodebRepository, _townRepository, townId, page); return(View(viewModel)); }
public ViewResult ENodebList(int townId, int page = 1) { ENodebListViewModel viewModel = new ENodebListViewModel(_townRepository, townId); viewModel.SetItems(page, pageSize); return View(viewModel); }
public void AssertTest(int townId, int expectedENodebs) { ViewResult viewResult = controller.ENodebList(townId); ENodebListViewModel viewModel = viewResult.Model as ENodebListViewModel; Assert.IsNotNull(viewModel); Assert.AreEqual(viewModel.TownId, townId); Assert.AreEqual(viewModel.Items.Count(), expectedENodebs); Assert.AreEqual(viewModel.QueryItems.Count(), expectedENodebs); }
public void AssertTest(IENodebRepository repository, int townId, int page, int pageSize, int expectedSize) { Mock<ITownRepository> townRepository = new Mock<ITownRepository>(); ENodebListViewModel viewModel = new ENodebListViewModel(repository, townRepository.Object, townId, page, pageSize); Assert.AreEqual(viewModel.TownId, townId); Assert.AreEqual(viewModel.PagingInfo.CurrentPage, page); Assert.AreEqual(viewModel.PagingInfo.ItemsPerPage, pageSize); Assert.AreEqual(viewModel.PagingInfo.TotalItems, expectedSize); Assert.AreEqual(viewModel.Items.Count(), page == (expectedSize / pageSize + 1) ? (expectedSize % pageSize) : pageSize); Assert.AreEqual(viewModel.QueryItems.Count(), expectedSize); }
public void AssertTest(IENodebRepository repository, int townId, int page, int pageSize, int expectedSize) { Mock <ITownRepository> townRepository = new Mock <ITownRepository>(); ENodebListViewModel viewModel = new ENodebListViewModel(repository, townRepository.Object, townId, page, pageSize); Assert.AreEqual(viewModel.TownId, townId); Assert.AreEqual(viewModel.PagingInfo.CurrentPage, page); Assert.AreEqual(viewModel.PagingInfo.ItemsPerPage, pageSize); Assert.AreEqual(viewModel.PagingInfo.TotalItems, expectedSize); Assert.AreEqual(viewModel.Items.Count(), page == (expectedSize / pageSize + 1) ? (expectedSize % pageSize) : pageSize); Assert.AreEqual(viewModel.QueryItems.Count(), expectedSize); }
public ViewResult ENodebList(int townId, int page = 1) { ENodebListViewModel viewModel = new ENodebListViewModel(_eNodebRepository, _townRepository, townId, page); return View(viewModel); }