public void AddToMorning()
 {
     Track t = new Track();
     t.MorningLastTime = new TimeSpan(11,0,0);
     IEvent talk = new Talk("Writing Fast Tests Against Enterprise Rails 60min");
     bool result = t.AddToMorningSession(talk);
     Assert.IsTrue(result);
     Assert.AreEqual(t.MorningSession.Count, 1);
     Assert.AreEqual(t.MorningLastTime, new TimeSpan(12, 0, 0));
     result = t.AddToMorningSession(talk);
     Assert.IsFalse(result);
 }
        public void Schedule(List<string> eventList)
        {
            List<IEvent> talks = new List<IEvent>();
            foreach (var eventItem in eventList)
            {
                talks.Add(new Talk(eventItem));
            }

            foreach (var talk in talks.OrderByDescending(tlk => tlk.Duration))
            {
                bool isInMorning = false;
                bool isInAfternoon = false;
                for (int i = 0; i < tracks.Count; i++)
                {
                    isInMorning = tracks[i].AddToMorningSession(talk);
                    if (isInMorning)
                    {
                        if(tracks[i].MorningLastTime == new TimeSpan(12,0,0))
                        {
                            tracks[i].MorningSession.Add(new Lunch());
                        }
                        break;
                    }
                    isInAfternoon = tracks[i].AddToAfternoonSession(talk);
                    if (isInAfternoon)
                    {
                        if(tracks[i].AfternoonLastTime > new TimeSpan(16,0,0))
                        {
                            IEvent nEvent = new NetworkingEvent();
                            if (nEvent.SetStartTime(tracks[i].AfternoonLastTime))
                            {
                                tracks[i].AddToAfternoonSession(nEvent);
                            }
                        }
                        break;
                    }
                }
                if (!(isInMorning || isInAfternoon))
                {
                    Track track = new Track();
                    track.AddToMorningSession(talk);
                    tracks.Add(track);
                }

            }
        }