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); } } }
public void SetNetworkingStart() { IEvent nEvent = new NetworkingEvent(); bool result = nEvent.SetStartTime(new TimeSpan(16, 30, 0)); Assert.IsTrue(result); }
public void FalseNetworkingStart() { IEvent nEvent = new NetworkingEvent(); bool result = nEvent.SetStartTime(new TimeSpan(17, 30, 0)); Assert.IsFalse(result); }