public void ShouldIntersectsWithBeFalseWhenDatSpansEndIsLowerThanOthersStart()
        {
            DateTime end1 = DateTime.Now;
            DateTime start2 = DateTime.Now.Add(TimeSpan.FromHours(1));
            DateSpan dateSpan1 = new DateSpan(DateTime.MinValue, end1);
            DateSpan dateSpan2 = new DateSpan(start2, DateTime.MaxValue);

            Assert.IsFalse(dateSpan1.IntersectWith(dateSpan2));
            Assert.IsFalse(dateSpan2.IntersectWith(dateSpan1));
        }
 public ICalendarEvent[] GetEvents(DateSpan schedule)
 {
     try
     {
         IEnumerable<ICalendarEvent> allEvents = TryReadingCalendarEvents();
         return allEvents.Where(e => e.Schedule.IntersectWith(schedule))
                         .ToArray();
     }
     catch (Exception)
     {
         return new ICalendarEvent[0];
     }
 }
 private static bool TryPromptForDateSpan(out DateSpan dateSpan)
 {
     try
       {
     DateTime startDate = ReadDate(string.Format("Start date (format {0}): ", DateFormat));
     DateTime endDate = ReadDate(string.Format("End date (format {0}):", DateFormat));
     dateSpan = new DateSpan(startDate, endDate);
     return true;
       }
       catch (ArgumentException argumentException)
       {
     Console.WriteLine("Error occured: " + argumentException.Message);
     dateSpan = DateSpan.Max;
     return false;
       }
 }
 public bool IntersectWith(DateSpan other)
 {
     return _endTime > other._startTime && _startTime < other._endTime;
 }
 public ICalendarEvent Create(DateSpan dateSpan, string title, string[] participants)
 {
     return new Meeting(dateSpan, title, participants);
 }
 protected CalendarEventBase(DateSpan schedule, string title)
 {
     this.schedule = schedule;
     this.title = title;
 }
 public Todo(DateSpan schedule, string title)
     : base(schedule, title)
 {
 }
 public bool IntersectWith(DateSpan other)
 {
     return endTime > other.startTime && startTime < other.endTime;
 }
 public ICalendarEvent[] GetEvents(DateSpan dateSpan)
 {
     return eventsRepository.GetEvents(dateSpan);
 }
 public CalendarEvent(DateSpan schedule, string title)
 {
     _schedule = schedule;
       _title = title;
 }
 public Meeting(DateSpan schedule, string title, string[] participants)
     : base(schedule, title)
 {
     this.participants = participants;
 }
 public ICalendarEvent Create(DateSpan schedule, string title)
 {
     return new Todo(schedule, title);
 }