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)); }
public ActionResult ViewChanges(DocumentVersion documentVersion) { if (documentVersion == null) return RedirectToAction("Index"); return PartialView(documentVersion); }
public void WebpageController_ViewChanges_ShouldReturnPartialViewResult() { var documentVersion = new DocumentVersion(); _webpageController.ViewChanges(documentVersion).Should().BeOfType<PartialViewResult>(); }
public RedirectToRouteResult Revert_POST(DocumentVersion documentVersion) { _service.RevertToVersion(documentVersion); return RedirectToAction("Edit", "Webpage", new { id = documentVersion.Document.Id }); }
public PartialViewResult Revert(DocumentVersion documentVersion) { return PartialView(documentVersion); }