public void AddsOneStudentToEmptyCourseSuccessfully() { _courseRepository.Setup(c => c.GetWithStudents(It.IsAny <long>())).Returns(new CourseBuilder().WithDefaultValues()); var serviceMock = new CourseStudentSignupService(_courseRepository.Object, _appLogger.Object, null); var student = new StudentBuilder().WithDefaultValues(); serviceMock.Signup(It.IsAny <long>(), student.Name, student.Age); }
public void ThrowsGivenFullCourseCapacity() { _courseRepository.Setup(c => c.GetWithStudents(It.IsAny <long>())).Returns(new CourseBuilder().WithFullCapacity()); var serviceMock = new CourseStudentSignupService(_courseRepository.Object, _appLogger.Object, null); var student = new StudentBuilder().WithDefaultValues(); Assert.Throws <CourseIsFullException>(() => serviceMock.Signup(It.IsAny <long>(), student.Name, student.Age)); }