public void DetailsTest() { PageController controller = new PageController(pageService); var result = controller.Details("About-Us") as ViewResult; var page = result.View; }
public void IndexTest() { PageController pc = new PageController(pageService); var result = pc.Index() as ViewResult; var model = result.ViewData.Model; Assert.IsTrue(model is List<PageModel>, "PageController.Index should return a List of PageModels"); }
public void UpdateTest() { Thread.CurrentPrincipal = EditorPrincipal; var routeData = new RouteData(); var httpContext = MockRepository.GenerateStub<HttpContextBase>(); FormCollection formParameters = new FormCollection(); PageController pc = new PageController(pageService); FormCollection fc = new FormCollection() { {"Title","Contact Us 2"}, {"Order","100"} }; ControllerContext controllerContext = MockRepository.GenerateStub<ControllerContext>(httpContext, routeData, pc); pc.ControllerContext = controllerContext; pc.ValueProvider = fc.ToValueProvider(); var ar = pc.Edit("Contact-Us", fc); }
public void UpdateListTest() { PageController pc = new PageController(pageService); FormCollection fc = new FormCollection() { {"pageID", "4d408ca4c946000000006641"}, {"frm_list_key_Jon-Lind", "Jon Lind 2"}, {"frm_list_value_Jon-Lind", "720-530-1172" } }; var ar = pc.Edit("Board Members", fc); }