public void Should_Enrol_With_NonFull_LectureTheatre() { var subject = CreateSubjectWithMaxCapacity(1); var result = EnrolmentService.CanStudentEnrolInSubject(new Student(), subject); Assert.True(result); }
public void Post(Guid studentId, Guid subjectId) { var student = studentsRepository.Get(studentId); var subject = subjectRepository.Get(subjectId); //TODO: Return correct status codes when not found if (EnrolmentService.CanStudentEnrolInSubject(student, subject)) { subject.AddStudent(student); student.AddSubject(subject); } }
public void Should_Enrol_Student_With_Less_Than_10_Hours() { var student = new Student(); var subject = CreateSubjectWithMaxCapacity(5); subject.Lectures.First().StartTime = new DateTimeOffset(1, 1, 1, 8, 0, 0, new TimeSpan()); // 10 am subject.Lectures.First().EndTime = new DateTimeOffset(1, 1, 1, 15, 0, 0, new TimeSpan()); // 5 pm var result = EnrolmentService.CanStudentEnrolInSubject(new Student(), subject); Assert.True(result); }