public void ReturnIndexView() { _controller = new DeveloperController(_repository.Object) { ControllerContext = MockHelper.FakeControllerContext(false) }; var res = (ViewResult)_controller.Index(); Assert.IsNotNull(res, "No view returned"); }
public void Index_ReturnsListOfDevelopers() { var developerList = new List <Developer>() { new Developer { ID = 1, Name = "LucasArts" } }; mockDeveloperRepo.Setup(x => x.GetAll()).Returns(developerList); mockDeveloperService.Setup(x => x.GetAll()).Returns(developerList); var result = developerController.Index() as ViewResult; Assert.IsNotNull(result); Assert.IsNotNull(result.Model); Assert.IsInstanceOf <IActionResult>(result); Assert.AreEqual("Index", result.ViewName); }