コード例 #1
0
 public void Allocate(Talk talk)
 {
     if (Morning.CanFit(talk.Minutes))
         Morning.Allocate(talk);
     else if (Afternoon.CanFit(talk.Minutes))
         Afternoon.Allocate(talk);
 }
コード例 #2
0
        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");
        }
コード例 #3
0
        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");
        }
コード例 #4
0
        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;
 }
コード例 #6
0
        public void Allocate(Talk talk)
        {
            var availableTimeSpan = TimeSpan.FromMinutes(AvailableMinutes);

            var startTime = EndTime - availableTimeSpan;

            talk.StartTime = startTime;

            Talks.Add(talk);
        }
コード例 #7
0
 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;
 }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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);
        }