public GradeChange FindGradeChangeByStudentId(string student_id)
 {
     var errors = new List<string>();
     var repository = new GradeChangeRepository(this.entities);
     var service = new GradeChangeService(repository);
     return service.FindGradeChangeByStudentId(student_id, ref errors);
 }
 public GradeChange FindGradeChangeByCourseId(int course_id)
 {
     var errors = new List<string>();
     var repository = new GradeChangeRepository(this.entities);
     var service = new GradeChangeService(repository);
     return service.FindGradeChangeByCourseId(course_id, ref errors);
 }
        public string ApproveGradeChange(GradeChange gc)
        {
            var errors = new List<string>();
            var repository = new GradeChangeRepository(this.entities);
            var service = new GradeChangeService(repository);
            service.ApproveGradeChange(gc, ref errors);

            if (errors.Count == 0)
            {
                return "ok";
            }

            return "error";
        }
        public void RespondToGradeChageTestError1()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<IGradeChangeRepository>();
            var gradeChangeService = new GradeChangeService(mockRepository.Object);
            var gc = new GradeChange { Course_id = -1 };

            //// Act
            gradeChangeService.ApproveGradeChange(gc, ref errors);

            //// Assert
            Assert.AreEqual(1, errors.Count);
        }
        public void RespondToGradeChageTest()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<IGradeChangeRepository>();
            var gradeChangeService = new GradeChangeService(mockRepository.Object);
            var gc = new GradeChange { Course_id = 5, GradeChangeId = 1 };

            mockRepository.Setup(x => x.ApproveGradeChange(5, ref errors));

            //// Act
            gradeChangeService.ApproveGradeChange(gc, ref errors);
            mockRepository.Verify(mock => mock.ApproveGradeChange(1, ref errors), Times.Once());

            //// Assert
            Assert.AreEqual(0, errors.Count);
        }
 public int GetGradeChangeScheduleId(string student_id, int course_id)
 {
     var errors = new List<string>();
     var repository = new GradeChangeRepository(this.entities);
     var service = new GradeChangeService(repository);
     return service.GetGradeChangeScheduleId(student_id, course_id, ref errors);
 }