public void Allocate(Talk talk) { if (Morning.CanFit(talk.Minutes)) Morning.Allocate(talk); else if (Afternoon.CanFit(talk.Minutes)) Afternoon.Allocate(talk); }
public void ShouldNotAddExtraLongTalkToMorningSession() { var track = new Track(); var talk = new Talk { Title = "Sample Talk 123", Minutes = 60 * 3 + 1 }; track.Allocate(talk); Assert.AreEqual(track.Afternoon.Talks.First().Title, "Sample Talk 123"); }
public void ShouldAddShortTalkToMorningSession() { var track = new Track(); var talk = new Talk { Title = "Sample Talk 123", Minutes = 1 }; track.Allocate(talk); Assert.AreEqual(track.Morning.Talks.First().Title, "Sample Talk 123"); }
public void ShouldHaveCorrectStartTime() { var morning = new Morning(); var talk = new Talk { Minutes = 1 }; morning.Allocate(talk); var startTime = new TimeSpan(9,0,0); Assert.AreEqual(talk.StartTime, startTime); }
private List<Talk> CreateTwoDaysSampleTalks() { var talks = new List<Talk>(); for (var i = 0; i < 14; i++) { var talk = new Talk { Minutes = 60 }; talks.Add(talk); } return talks; }
public void Allocate(Talk talk) { var availableTimeSpan = TimeSpan.FromMinutes(AvailableMinutes); var startTime = EndTime - availableTimeSpan; talk.StartTime = startTime; Talks.Add(talk); }
private List<Talk> CreateFullDaySampleTalks() { var talks = new List<Talk>(); for (var i = 0; i < 3; i++) { var talk = new Talk { Minutes = i * 10 }; talks.Add(talk); } return talks; }
public void ShouldJustFillMorningSession() { var track = new Track(); var talk1 = new Talk { Title = "Sample Talk 1", Minutes = 179 }; track.Allocate(talk1); var talk2 = new Talk { Title = "Sample Talk 2", Minutes = 1 }; track.Allocate(talk1); Assert.AreEqual(1, track.Morning.Talks.Count); }
public void ShouldBringNetworkingForwardToFourPM() { var track = new Track(); var talk = new Talk { Title = "Sample Talk 123", Minutes = 1 }; track.Allocate(talk); var networkingTime = track.NetworkingTime; var fourPM = new TimeSpan(16, 0, 0); Assert.AreEqual(networkingTime, fourPM); }
public void ShouldNotGoOvertime() { var track = new Track(); var talk1 = new Talk { Title = "Sample Talk 1", Minutes = 179 }; track.Allocate(talk1); var talk2 = new Talk { Title = "Sample Talk 2", Minutes = 2 }; track.Allocate(talk1); Assert.AreEqual(1, track.Morning.Talks.Count); }