public void DocumentVersionService_GetDocumentVersion_GetsTheVersionWithTheRequestedId()
        {
            var documentVersion = new DocumentVersion();
            Session.Transact(session => session.Save(documentVersion));

            DocumentVersion version = _documentVersionsAdminService.GetDocumentVersion(documentVersion.Id);

            version.Should().Be(documentVersion);
        }
        public void RevertToVersion(DocumentVersion documentVersion)
        {
            var currentVersion = documentVersion.Document;
            var previousVersion = currentVersion.GetVersion(documentVersion.Id);

            var versionProperties = currentVersion.GetType().GetVersionProperties();
            foreach (var versionProperty in versionProperties)
            {
                versionProperty.SetValue(currentVersion, versionProperty.GetValue(previousVersion, null), null);
            }
            _session.Transact(session => session.Update(currentVersion));
        }
Example #3
0
        public ActionResult ViewChanges(DocumentVersion documentVersion)
        {
            if (documentVersion == null)
                return RedirectToAction("Index");

            return PartialView(documentVersion);
        }
Example #4
0
        public void WebpageController_ViewChanges_ShouldReturnPartialViewResult()
        {
            var documentVersion = new DocumentVersion();

            _webpageController.ViewChanges(documentVersion).Should().BeOfType<PartialViewResult>();
        }
Example #5
0
 public RedirectToRouteResult Revert_POST(DocumentVersion documentVersion)
 {
     _service.RevertToVersion(documentVersion);
     return RedirectToAction("Edit", "Webpage", new { id = documentVersion.Document.Id });
 }
Example #6
0
 public PartialViewResult Revert(DocumentVersion documentVersion)
 {
     return PartialView(documentVersion);
 }