public async Task GetAllAsync_ReturnsOkAndListOfStudents() { Mock <IStudentRepository> studentRepositoryMock = new Mock <IStudentRepository>(); studentRepositoryMock.Setup(m => m.GetAllAsync()).ReturnsAsync(this.GetStudents()); IStudentService studentService = new StudentService(studentRepositoryMock.Object); var studentController = new StudentsController(studentService, this.CreateMapper()); var expected = this.GetStudents(); var result = await studentController.GetAllAsync(); var okResult = Assert.IsType <OkObjectResult>(result); var actual = Assert.IsAssignableFrom <IEnumerable <DataAccess.Model.Student> >(okResult.Value); actual.Should().NotBeNull(); actual.Should().HaveCountGreaterThan(0); actual.Should().HaveCount(2); actual.Should().BeEquivalentTo(expected); }