public void can_tell_timespan()
        {
            var timeSpan = new ScheduleTimeSpan(8M, 9M);
            var subject = new ProviderOrgUnitSchedule(timeSpan);

            Assert.IsTrue(subject.TimeSpan.Equals(timeSpan));
        }
        public void can_construct_from_timespan()
        {
            var timeSpan = new ScheduleTimeSpan(8M, 9M);
            var subject = new ProviderOrgUnitSchedule(timeSpan);

            Assert.IsTrue(subject.OpenHours == timeSpan.OpenHours);
            Assert.IsTrue(subject.OpenTime == timeSpan.OpenTime);
        }
Пример #3
0
        /// <summary>
        /// Adds the schedule.
        /// </summary>
        /// <param name="scheduleTimeSpan">The schedule time span.</param>
        public ProviderOrgUnitSchedule AddSchedule(ScheduleTimeSpan scheduleTimeSpan)
        {
            if (scheduleTimeSpan == null)
            {
                throw new ArgumentNullException("scheduleTimeSpan");
            }
            if (Schedules.Count(pls => pls.TimeSpan.Equals(scheduleTimeSpan)) > 0)
            {
                throw new BusinessException("Cannot add duplicate schedule Time Spans.");
            }
            if (Schedules.Count(pls => pls.TimeSpan.Overlaps(scheduleTimeSpan)) > 0)
            {
                throw new BusinessException("Schedule Time Spans cannot overlap.");
            }

            var schedule = new ProviderOrgUnitSchedule(scheduleTimeSpan);
            Schedules.Add(schedule);

            return schedule;
        }