public async Task Add_Student_To_Invalid_Course_Test() { CourseRepository repository = new CourseRepository(context, logger); var student = new Student { Name = "Sara Bailey Winston", Email = "*****@*****.**", DateOfBirth = new System.DateTime(2000, 03, 12) }; var course = new Course { Id = Guid.NewGuid(), Name = "Invalid subject", Capacity = 0 }; var result = await repository.AddStudentToCourseAsync(course, student); Assert.False(result); }
public async Task Add_Student_To_Course_Test() { CourseRepository repository = new CourseRepository(context, logger); var student = new Student { Name = "Sara Bailey Winston", Email = "*****@*****.**", DateOfBirth = new DateTime(2000, 03, 12) }; var courses = await repository.GetAllAsync(); var firstCourse = courses.FirstOrDefault(); await repository.AddStudentToCourseAsync(firstCourse, student); var persistedCourse = await repository.GetByIdAsync(firstCourse.Id); Assert.NotNull(persistedCourse); Assert.True(persistedCourse.Students.Count > 0); }