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); }
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"; }
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"; }
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); }
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()); }
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); }
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); }
public Schedule GetScheduleById(int id) { var service = new ScheduleService(new ScheduleRepository(this.entities)); var errors = new List<string>(); return service.GetScheduleById(id, ref errors); }
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); }
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); }
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); }
public List<ScheduleDay> GetDays() { var service = new ScheduleService(new ScheduleRepository(this.entities)); var errors = new List<string>(); return service.GetDays(ref errors); }
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); }
/// <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); }