Esempio n. 1
0
        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});
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
 public virtual void Save(WikiPage page)
 {
     this.PageStore[page.Title] = page;
 }
Esempio n. 4
0
 public virtual void Save(WikiPage page)
 {
     this.PageStore[page.Title] = page;
 }