Exemplo n.º 1
0
        public void Edit_Get_returns_a_404_when_no_issue_is_found()
        {
            // Act
            var result = controller.Edit(4) as HttpNotFoundResult;

            // Assert
            Assert.AreEqual(404, result.StatusCode);
        }
Exemplo n.º 2
0
        public void Edit_Get_returns_an_EditViewModel_for_the_correct_issue()
        {
            // Arrange
            var editableIssue = Mock.Of <Issue>(i => i.Title == "Title" && i.Id == 1 && i.ShortDescription == "Short" && i.LongDescription == "Long");

            _repo = new Mock <IIssueRepository>();
            _repo.Setup(r => r.Find(1)).Returns(editableIssue);
            var newController = new IssuesController(_repo.Object);

            // Act
            var result = newController.Edit(1) as ViewResult;

            // Assert
            result.Model.ShouldDeepEqual((EditViewModel)editableIssue);
        }