public void IndexActionMethod_ReturnsAViewResult() { // arrange var rep = new Mock <IRepository <Sprint> >(); var controller = new SprintController(rep.Object); // act var result = controller.Index(); // assert Assert.IsType <ViewResult>(result); }
public void IndexTest() { //Arrange var mock = new Mock <ISprintService>(); mock.Setup(i => i.GetAllSprints()).Returns(new List <SprintDTO>().AsQueryable()); SprintController controller = new SprintController(mock.Object); //Act var result = controller.Index(); //Assert mock.Verify(i => i.GetAllSprints(), Times.Once); }