Ejemplo n.º 1
0
        private bool bedTimePreceedsEndTime(TwentyFourHourTime bedTime)
        {
            switch (_endTimePeriod)
            {
            case TIME_OF_DAY.PM:
                if (bedTime.CompareTo(StartTime) >= 0 && bedTime.CompareTo(EndTime) <= 0)
                {
                    return(true);
                }
                throw new ArgumentException("Bed time must come before end time");
                return(false);

                break;

            default:
                if (bedTime.CompareTo(EndTime) <= 0 || bedTime.CompareTo(EARLIEST_START_TIME) >= 0)
                {
                    return(true);
                }
                throw new ArgumentException("Bed time must come before end time");
                return(false);

                break;
            }
        }
Ejemplo n.º 2
0
        private bool startTimePreceedsEndTime(TwentyFourHourTime endTime)
        {
            switch (_startTimePeriod)
            {
            case TIME_OF_DAY.AM:
                if (endTime.CompareTo(_startTime) >= 0 && endTime.CompareTo(LATEST_END_TIME) <= 0)
                {
                    return(true);
                }
                throw new ArgumentException("End time must come after start time");
                return(false);

                break;

            default:
                if (endTime.CompareTo(_startTime) >= 0 || endTime.CompareTo(LATEST_END_TIME) <= 0)
                {
                    return(true);
                }
                throw new ArgumentException("End time must come after start time");
                return(false);

                break;
            }
        }
Ejemplo n.º 3
0
 private bool endTimeIsValid(TwentyFourHourTime endTime)
 {
     if ((endTime.CompareTo(EARLIEST_START_TIME) >= 0 || endTime.CompareTo(LATEST_END_TIME) <= 0) && startTimePreceedsEndTime(endTime))
     {
         return(true);
     }
     throw new ArgumentOutOfRangeException("Babysitters cannot work after 4:00AM");
     return(false);
 }
Ejemplo n.º 4
0
 private int calculateHoursBeforeBedtime_EveningStart()
 {
     if (_bedTime.CompareTo(EARLIEST_START_TIME) < 0)
     {
         return((int)Math.Round(ONE_MINUTE_TO_MIDNIGHT.Minus(_startTime) + _bedTime.Minus(MIDNIGHT)));
     }
     return((int)Math.Round(_bedTime.Minus(_startTime)));
 }
Ejemplo n.º 5
0
 private bool startTimePreceedsBedTime(TwentyFourHourTime bedTime)
 {
     if (bedTime.CompareTo(StartTime) >= 0)
     {
         return(true);
     }
     throw new ArgumentException("Bed time must come after start time");
     return(false);
 }
Ejemplo n.º 6
0
 private bool startTimeIsValid(TwentyFourHourTime startTime)
 {
     if (startTime.CompareTo(EARLIEST_START_TIME) >= 0)
     {
         return(true);
     }
     throw new ArgumentOutOfRangeException("Babysitter cannot start work before 5:00PM or after Midnight");
     return(false);
 }