Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
        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";
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 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);
 }