public ActionResult Edit(WikiPageViewModel viewModel) { var page = new WikiPage() { Body = viewModel.Body, Title = viewModel.Title, }; this._pageService.Save(page); return RedirectToAction("Index", new {id = page.Title}); }
public void Edit() { //Given var wikiPage = new WikiPage() { Title = "Some page", Body = "Some body text", }; this.PageService.Get("Some page").Returns(wikiPage); // When var result = this.Subject.Edit("Some page"); var viewResult = result as ViewResult; Assert.That(viewResult.Model, Is.InstanceOf<WikiPageViewModel>()); var viewModel = viewResult.Model as WikiPageViewModel; Assert.That(viewModel.Title, Is.EqualTo(wikiPage.Title)); Assert.That(viewModel.Body, Is.EqualTo(wikiPage.Body)); }
public virtual void Save(WikiPage page) { this.PageStore[page.Title] = page; }