Ejemplo n.º 1
0
        public void Revert_Should_Return_RedirectToRouteResult_With_Page_Id()
        {
            // Arrange
            _contextStub.IsAdmin = true;
            Page page = AddDummyPage1();

            Guid version2Guid = Guid.NewGuid();
            Guid version3Guid = Guid.NewGuid();

            _repository.PageContents.Add(new PageContent()
            {
                Id = version2Guid, Page = page, Text = "version2 text"
            });
            _repository.PageContents.Add(new PageContent()
            {
                Id = version3Guid, Page = page, Text = "version3 text"
            });

            // Act
            ActionResult result = _pagesController.Revert(version2Guid, page.Id);

            // Assert
            Assert.That(result, Is.TypeOf <RedirectToRouteResult>(), "RedirectToRouteResult not returned");
            RedirectToRouteResult redirectResult = result as RedirectToRouteResult;

            Assert.NotNull(redirectResult, "Null RedirectToRouteResult");

            Assert.That(redirectResult.RouteValues["action"], Is.EqualTo("History"));
            Assert.That(redirectResult.RouteValues["id"], Is.EqualTo(1));
        }