Exemplo n.º 1
0
        public void DefaultView_HasSomeIssues()
        {
            var controller = new IssuesController();

            var result = controller.Index() as ViewResult;
            var issues = result.Model as IEnumerable <Issue>;

            Assert.IsNotEmpty(issues);
            //Assert.AreEqual("Teach mocks", issues.First().Title);
        }
Exemplo n.º 2
0
        public void Index_ReturnsListWithBorrowedBooks()
        {
            // Arrange
            _mockRepo.Setup(repo => repo.GetAllIssuedBooks()).Returns(GetTestData());
            _mockUnitOfWork.Setup(uow => uow.Issues).Returns(_mockRepo.Object);

            // Act
            var result = _controller.Index("", "");

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <IEnumerable <IssueReturnViewModel> >(viewResult.ViewData.Model);

            Assert.Equal(2, model.Count());
        }