public ActionResult CreatePage(StaticPage page) { var manager = new AdminManager(); var pageCount = manager.GetAllPages().Count; manager.AddPage(page); page.PageDate = DateTime.Now; if (pageCount == 0) { page.PageID = 1; } else page.PageID = manager.GetAllPages().Count + 1; return RedirectToAction("Index", "Home"); }
public void CanAddStaticPage() { var manager = new AdminManager(); var pageCount = manager.GetAllPages().Count; var toAdd = new StaticPage(); toAdd.PageID = pageCount + 1; toAdd.PageTitle = "Test title"; toAdd.PageBody = "test static page"; toAdd.PageDate = DateTime.Now; manager.AddPage(toAdd); var secondCount = manager.GetAllPages().Count; Assert.AreEqual(pageCount +1, secondCount); }