public async Task ShouldReturnFalseIfThereIsNotAvailability() { //ARRANGE const int courseId = 1; var session = new Session { CourseId = 1, MaxCapacity = 2, NumberOfStudents = 1 }; _sessionRepository.Setup(s => s.FirstOrDefaultAsync(It.IsAny <Expression <Func <Session, bool> > >())).Returns(Task.FromResult(session)); var sut = new CoursesService(_courseRepository.Object, _sessionRepository.Object, _ssRepository.Object, _studentRepository.Object); //ACT var res = await sut.CheckAvailabilityAsync(courseId); //ASSERT Assert.False(res); }