Esempio n. 1
0
        public void gethistory_returns_correct_items()
        {
            // Arrange
            Page page = NewPage("admin");
            PageContent v1Content = _pageRepository.AddNewPage(page, "v1 text", "admin", DateTime.Today.AddDays(-1));
            PageContent v2Content = _pageRepository.AddNewPageContentVersion(page, "v2 text", "admin", DateTime.Today.AddDays(-1).AddHours(1), 2);

            page = v2Content.Page; // update the id
            page.IsLocked = true;

            // Act
            List<PageHistoryViewModel> historyList = _historyService.GetHistory(v1Content.Page.Id).ToList();

            // Assert
            Assert.That(historyList.Count, Is.EqualTo(2));
            Assert.That(historyList[0].Id, Is.EqualTo(v2Content.Id));
            Assert.That(historyList[0].EditedBy, Is.EqualTo(v2Content.EditedBy));
            Assert.That(historyList[0].EditedOn, Is.EqualTo(v2Content.EditedOn));
            Assert.That(historyList[0].EditedOnWithOffset, Is.Not.Empty);
            Assert.That(historyList[0].IsPageAdminOnly, Is.EqualTo(page.IsLocked));
            Assert.That(historyList[0].PageId, Is.EqualTo(page.Id));
            Assert.That(historyList[0].VersionNumber, Is.EqualTo(v2Content.VersionNumber));
        }
Esempio n. 2
0
 public ActionResult History(int id)
 {
     ViewData["PageId"] = id;
     return(View(_historyService.GetHistory(id).ToList()));
 }