示例#1
0
        public void AddCourseToScheduleErrorTest1()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<IScheduleRepository>();
            var scheduleService = new ScheduleService(mockRepository.Object);
            ///  int? nullInt = null;
            //// Act
            scheduleService.AddCourseToSchedule(null, ref errors);

            //// Assert cant be null course object
            Assert.AreEqual(1, errors.Count);
        }
示例#2
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";
        }