Ejemplo n.º 1
0
        public List <PrereqOverride> GetPrereqOverride(int scheduleId)
        {
            var service = new PrereqOverrideService(new PrereqOverrideRepository());
            var errors  = new List <string>();

            return(service.GetPrereqOverride(scheduleId, ref errors));
        }
Ejemplo n.º 2
0
        public List <PrereqOverride> GetAllPrereqOverride()
        {
            var service = new PrereqOverrideService(new PrereqOverrideRepository());
            var errors  = new List <string>();

            return(service.GetAllPrereqOverride(ref errors));
        }
Ejemplo n.º 3
0
        ////[ExpectedException(typeof(ArgumentException))]
        public void InsertPrereqOverrideErrorTest()
        {
            //// Arrange
            var errors                = new List <string>();
            var mockRepository        = new Mock <IPrereqOverrideRepository>();
            var prereqOverrideService = new PrereqOverrideService(mockRepository.Object);

            //// Act
            prereqOverrideService.InsertPrereqOverride(null, ref errors);

            //// Assert
            Assert.AreEqual(1, errors.Count);
        }
Ejemplo n.º 4
0
        public string UpdatePrereqOverride(PrereqOverride prereq)
        {
            var errors     = new List <string>();
            var repository = new PrereqOverrideRepository();
            var service    = new PrereqOverrideService(repository);

            service.UpdatePrereqOverride(prereq, ref errors);

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

            return("error");
        }
Ejemplo n.º 5
0
        //// [ExpectedException(typeof(ArgumentException))]
        public void InsertPrereqOverrideNegativeScheduleIdTest()
        {
            //// Arrange
            var errors                = new List <string>();
            var mockRepository        = new Mock <IPrereqOverrideRepository>();
            var prereqOverrideService = new PrereqOverrideService(mockRepository.Object);
            var prereq                = new PrereqOverride {
                StudentId = "A01234567", ScheduleId = -1, ProfPrereqOverrideStatus = 1, AdminPrereqOverrideStatus = 0
            };

            //// Act
            prereqOverrideService.InsertPrereqOverride(prereq, ref errors);

            //// Assert
            Assert.AreEqual(1, errors.Count);
        }
Ejemplo n.º 6
0
        //// [ExpectedException(typeof(ArgumentException))]
        public void UpdatePrereqOverrideSuccessTest()
        {
            //// Arrange
            var errors                = new List <string>();
            var mockRepository        = new Mock <IPrereqOverrideRepository>();
            var prereqOverrideService = new PrereqOverrideService(mockRepository.Object);

            var prereq = new PrereqOverride {
                StudentId = "A0123456", ScheduleId = 2, ProfPrereqOverrideStatus = 1, AdminPrereqOverrideStatus = 0
            };

            //// Act
            prereqOverrideService.UpdatePrereqOverride(prereq, ref errors);

            //// Assert
            Assert.AreEqual(0, errors.Count);
        }
Ejemplo n.º 7
0
        ////[ExpectedException(typeof(ArgumentException))]
        public void UpdatePrereqOverrideEmptyStudentIdTest()
        {
            //// Arrange
            var errors                = new List <string>();
            var mockRepository        = new Mock <IPrereqOverrideRepository>();
            var prereqOverrideService = new PrereqOverrideService(mockRepository.Object);

            var prereq = new PrereqOverride {
                StudentId = string.Empty
            };

            //// Act
            prereqOverrideService.UpdatePrereqOverride(prereq, ref errors);

            //// Assert
            Assert.AreEqual(1, errors.Count);
        }
Ejemplo n.º 8
0
        public void GetPrereqOverrideTest()
        {
            //// Arrange
            var errors                = new List <string>();
            var mockRepository        = new Mock <IPrereqOverrideRepository>();
            var prereqOverrideService = new PrereqOverrideService(mockRepository.Object);

            var prereqList = new List <PrereqOverride>();

            prereqList.Add(new PrereqOverride {
                StudentId = "A0123456", ScheduleId = 445678, ProfPrereqOverrideStatus = 1, AdminPrereqOverrideStatus = 0
            });
            prereqList.Add(new PrereqOverride {
                StudentId = "A0123886", ScheduleId = 445678, ProfPrereqOverrideStatus = 1, AdminPrereqOverrideStatus = 1
            });
            mockRepository.Setup(x => x.GetPrereqOverride(445678, ref errors)).Returns(prereqList);

            //// Act
            var newList = prereqOverrideService.GetPrereqOverride(445678, ref errors);

            //// Assert
            Assert.AreEqual(prereqList, newList);
        }