public void All_WithoutCurrentUser_RetunrnsIView() { var database = new Mock<IBangaloreUniversityData>(); database.Setup(data => data.Courses.GetAll()).Returns(new List<Course>()); var controller = new CoursesController(database.Object, null); var result = controller.All(); Assert.IsInstanceOfType(result, typeof(IView)); }
public void All_WithValidData_ShouldCallDatabaseGetAll() { var user = new User("Pesho", "1234567", Role.Lecturer); var database = new Mock<IBangaloreUniversityData>(); database.Setup(data => data.Courses.GetAll()).Returns(new List<Course>()); var controller = new CoursesController(database.Object, user); controller.All(); database.Verify(data => data.Courses.GetAll(), Times.Exactly(1)); }
public void All_ReturnsIView() { var user = new User("Pesho", "1234567", Role.Lecturer); var database = new Mock<IBangaloreUniversityData>(); database.Setup(data => data.Courses.GetAll()).Returns(new List<Course>()); var controller = new CoursesController(database.Object, user); var result = controller.All(); Assert.IsInstanceOfType(result, typeof(IView)); }