Пример #1
0
        public void AddCourseToScheduleErrorTest3()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<IScheduleRepository>();
            var scheduleService = new ScheduleService(mockRepository.Object);
            var schedule = new Schedule { };
            //// Act
            scheduleService.AddCourseToSchedule(schedule, ref errors);

            //// Assert cant be null course object
            Assert.AreEqual(1, errors.Count);
        }
        public void InsertToSchTest()
        {
            //// Arrange
            var errors = new List<String>();
            var mockRepository = new Mock<IScheduleRepository>();
            var scheduleService = new ScheduleService(mockRepository.Object);

            //// Act
            scheduleService.InsertToSchedule(null, ref errors);

            //// Assert
            Assert.AreEqual(1, errors.Count);
        }
        public void DeleteFromSchTest2()
        {
            //// Arrange
            var errors = new List<String>();
            var mockRepository = new Mock<IScheduleRepository>();
            var scheduleService = new ScheduleService(mockRepository.Object);
            var schedule = new Schedule { Quarter = string.Empty, Year = string.Empty };

            //// Act
            scheduleService.DeleteFromSchedule(schedule, ref errors);

            //// Assert
            Assert.AreEqual(5, errors.Count);
        }
Пример #4
0
        public string DeleteCourseFromSchedule(int id)
        {
            var errors = new List<string>();
            var repository = new ScheduleRepository(this.entities);
            var service = new ScheduleService(repository);
            service.RemoveCourseFromSchedule(id, ref errors);

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

            return "error";
        }
Пример #5
0
        public string DeleteAllFromSchedule(ScheduleMin schedule)
        {
            var errors = new List<string>();
            var repository = new ScheduleRepository(this.entities);
            var service = new ScheduleService(repository);
            service.RemoveWholeSchedule(schedule.Year, schedule.Quarter, ref errors);

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

            return "error";
        }
Пример #6
0
        public string AddCourseToSchedule(Schedule schedule)
        {
            var errors = new List<string>();
            var repository = new ScheduleRepository(this.entities);
            var service = new ScheduleService(repository);
            service.AddCourseToSchedule(schedule, ref errors);

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

            return "error";
        }
        public void GetSchTest()
        {
            //// Arrange
            var errors = new List<String>();
            var mockRepository = new Mock<IScheduleRepository>();
            var scheduleService = new ScheduleService(mockRepository.Object);
            String year = string.Empty;
            String quarter = string.Empty;

            //// Act
            scheduleService.GetScheduleList(year, quarter, ref errors);

            //// Assert
            Assert.AreEqual(2, errors.Count);
        }
Пример #8
0
        public void AddCourseScheduleTest()
        {
            //// Arranage
            var errors = new List<string>();

            Mock<IScheduleRepository> mockRepository = new Mock<IScheduleRepository>();
            ScheduleService iserv = new ScheduleService(mockRepository.Object);

            Schedule s = new Schedule { ScheduleId = 99, Year = "1000", Quarter = "Winter", Session = "2" };

            mockRepository.Setup(x => x.AddCourseToSchedule(s, ref errors));

            //// Act
            ////iserv.AddCourseToSchedule(s, ref errors);

            //// Assert
            ////mockRepository.Verify(x => x.AddCourseToSchedule(s, ref errors), Times.Once());
        }
Пример #9
0
        public void RemoveCourseFromScheduleErrorTest()
        {
            //// Arrange
            var errors = new List<string>();

            var mockRepository = new Mock<IScheduleRepository>();
            var scheduleService = new ScheduleService(mockRepository.Object);

            //// Act
            scheduleService.RemoveCourseFromSchedule(0, ref errors);

            //// Assert course id cannot be null
            Assert.AreEqual(1, errors.Count);
        }
Пример #10
0
        public List<Schedule> GetInstructorSchedule(int instructorId)
        {
            var service = new ScheduleService(new ScheduleRepository(this.entities));
            var errors = new List<string>();

            return service.GetInstructorSchedule(instructorId, ref errors);
        }
Пример #11
0
        public Schedule GetScheduleById(int id)
        {
            var service = new ScheduleService(new ScheduleRepository(this.entities));
            var errors = new List<string>();

            return service.GetScheduleById(id, ref errors);
        }
Пример #12
0
        public List<Ta> GetTaBySchedule(int scheduleId)
        {
            var service = new ScheduleService(new ScheduleRepository(this.entities));
            var errors = new List<string>();

            return service.GetTaBySchedule(scheduleId, ref errors);
        }
Пример #13
0
        public List<ScheduleMin> GetStudentScheduleListMin(string id)
        {
            var service = new ScheduleService(new ScheduleRepository(this.entities));
            var errors = new List<string>();

            return service.GetStudentScheduleMin(id, ref errors);
        }
Пример #14
0
        public List<Schedule> GetScheduleList(string year, string quarter)
        {
            var service = new ScheduleService(new ScheduleRepository(this.entities));
            var errors = new List<string>();

            return service.GetScheduleList(year, quarter, ref errors);
        }
Пример #15
0
 public List<ScheduleDay> GetDays()
 {
     var service = new ScheduleService(new ScheduleRepository(this.entities));
     var errors = new List<string>();
     return service.GetDays(ref errors);
 }
Пример #16
0
        public void GetScheduleListTest()
        {
            //// Arrange
            var errors = new List<string>();

            Mock<IScheduleRepository> mockRepository = new Mock<IScheduleRepository>();
            ScheduleService schedservice = new ScheduleService(mockRepository.Object);

            List<Schedule> crl = new List<Schedule>();
            crl.Add(new Schedule { ScheduleId = 99, Year = "1000", Quarter = "Winter", Session = "2" });

            mockRepository.Setup(x => x.GetScheduleList("1000", "Winter", ref errors)).Returns(crl);

            //// Act
            Schedule temp = schedservice.GetScheduleList("1000", "Winter", ref errors)[0];

            //// Assert
            Assert.AreEqual(99, temp.ScheduleId);
            ////Assert.AreEqual(3, rating);
        }
Пример #17
0
 /// <summary>
 /// Get a list of schedule with filtering
 /// </summary>
 /// <param name="year">year selected</param>
 /// <param name="quarter">quarter selected</param>
 /// <param name="errors">error list</param>
 /// <returns>list of schedule</returns>
 public List<Schedule> GetScheduleList(string year, string quarter, ref List<string> errors)
 {
     var service = new ScheduleService(new ScheduleRepository());
     return service.GetScheduleList(year, quarter, ref errors);
 }