Exemplo n.º 1
0
        public void AddRange_ScheduleListHasANull_ThrowsArgumentNullException()
        {
            // Arrange
            var schedules = new List <Schedule>
            {
                new Schedule {
                    Day = Day.Monday, OfferingId = 3, Offering = FakeScheduleRepository.computerLabJohnDSpring2017, StartTime = new DateTime(new TimeSpan(8, 15, 0).Ticks), EndTime = new DateTime(new TimeSpan(10, 0, 0).Ticks)
                },
                new Schedule {
                    Day = Day.Wednesday, OfferingId = 3, Offering = FakeScheduleRepository.computerLabJohnDSpring2017, StartTime = new DateTime(new TimeSpan(8, 15, 0).Ticks), EndTime = new DateTime(new TimeSpan(10, 0, 0).Ticks)
                },
                new Schedule {
                    Day = Day.Tuesday, OfferingId = 3, Offering = FakeScheduleRepository.computerLabJohnDSpring2017, StartTime = new DateTime(new TimeSpan(13, 15, 0).Ticks), EndTime = new DateTime(new TimeSpan(15, 0, 0).Ticks)
                },
                new Schedule {
                    Day = Day.Thrusday, OfferingId = 3, Offering = FakeScheduleRepository.computerLabJohnDSpring2017, StartTime = new DateTime(new TimeSpan(13, 15, 0).Ticks), EndTime = new DateTime(new TimeSpan(15, 0, 0).Ticks)
                },
                null
            };

            // Act and Assert
            var ex = Assert.Throws <ArgumentNullException>(() => _scheduleService.AddRange(schedules));

            Assert.IsTrue(ex.Message.Contains("schedules"));
        }
Exemplo n.º 2
0
        public bool Add()
        {
            this.ScheduleCollection.ForEach(x =>
            {
                x.ChamberId = this.ChamberId;
                x.DoctorId  = AuthenticatedDoctorUserModel.GetDoctorUserFromIdentity().Id;
            });

            return(_scheduleService.AddRange(this.ScheduleCollection));
        }