public List<Enrollment> GetStudentEnrolledSchedulesByQuarter(string studentId, string year, string quarter) { var errors = new List<string>(); var repository = new EnrollmentRepository(this.entities); var service = new EnrollmentService(repository); return service.GetStudentEnrolledSchedulesByQuarter(studentId, year, quarter, ref errors); }
public Enrollment GetEnrollmentDetail(string studentId, int scheduleId) { var errors = new List<string>(); var repository = new EnrollmentRepository(this.entities); var service = new EnrollmentService(repository); return service.GetEnrollmentDetail(studentId, scheduleId, ref errors); }
public List<Enrollment> GetAllStudentEnrolledSchedules(string studentId) { var errors = new List<string>(); var repository = new EnrollmentRepository(this.entities); var service = new EnrollmentService(repository); return service.GetAllStudentEnrolledSchedules(studentId, ref errors); }
public void AddEnrollmentErrorTest3() { //// Arranage var errors = new List<string>(); var mockRepository = new Mock<IEnrollmentRepository>(); var enrollmentService = new EnrollmentService(mockRepository.Object); int? nullInt = null; //// Act enrollmentService.AddEnrollment("1", (int)nullInt, ref errors); //// Assert cant be null course object Assert.AreEqual(1, errors.Count); }
public string AddEnrollment(Enrollment enrollment) { var errors = new List<string>(); var repository = new EnrollmentRepository(this.entities); var service = new EnrollmentService(repository); service.AddEnrollment(enrollment.StudentId, enrollment.ScheduleId, ref errors); if (errors.Count == 0) { return "ok"; } return "error"; }
public void AddEnrollmentTest() { //// Arranage var errors = new List<string>(); Mock<IEnrollmentRepository> mockRepository = new Mock<IEnrollmentRepository>(); EnrollmentService iserv = new EnrollmentService(mockRepository.Object); Enrollment s = new Enrollment { StudentId = "99", ScheduleId = 1000, Grade = "A+", GradeValue = 3.0f }; mockRepository.Setup(x => x.AddEnrollment("99", 1000, ref errors)); mockRepository.Setup(x => x.IsNotDuplicateEnrollment("99", 1000, ref errors)).Returns(true); //// Act iserv.AddEnrollment("99", 1000, ref errors); //// Assert mockRepository.Verify(x => x.AddEnrollment("99", 1000, ref errors), Times.Once()); }
public void RemoveEnrollmentServiceTest() { //// Arrange var errors = new List<string>(); Mock<IEnrollmentRepository> mockRepository = new Mock<IEnrollmentRepository>(); EnrollmentService enrollservice = new EnrollmentService(mockRepository.Object); List<Enrollment> crl = new List<Enrollment>(); crl.Add(new Enrollment { StudentId = "99", ScheduleId = 1000, Grade = "A+", GradeValue = 3.0f }); mockRepository.Setup(x => x.RemoveEnrollment("99", 1000, ref errors)); //// Act enrollservice.RemoveEnrollment("99", 1000, ref errors); //// Assert Assert.AreEqual(0, errors.Count); ////Assert.AreEqual(3, rating); }
public void RemoveEnrollmentErrorTest1() { //// Arrange var errors = new List<string>(); var mockRepository = new Mock<IEnrollmentRepository>(); var enrollmentService = new EnrollmentService(mockRepository.Object); //// Act enrollmentService.RemoveEnrollment(string.Empty, 1, ref errors); //// Assert course id cannot be null Assert.AreEqual(1, errors.Count); }
public List<Student> GetStudentsByScheduleId(int scheduleId) { var errors = new List<string>(); var repository = new EnrollmentRepository(this.entities); var service = new EnrollmentService(repository); return service.GetStudentsByScheduleId(scheduleId, ref errors); }
public string UpdateEnrollment(Enrollment er) { var errors = new List<string>(); var repository = new EnrollmentRepository(this.entities); var service = new EnrollmentService(repository); service.UpdateEnrollment(er, ref errors); if (errors.Count == 0) { return "ok"; } return "error"; }