Esempio n. 1
0
        public void IntegrationTestWithSample2()
        {
            //Arrange
            var inputTalkList = new List <string>
            {
                "Writing Fast Tests Against Enterprise Rails 60min",
                "Lua for the Masses 30min",
                "Ruby Errors from Mismatched Gem Versions 45min",
                "Accounting-Driven Development 45min",
                "Rails for Python Developers lightning",
                "Sit Down and Write 30min",
                "Rails Magic 60min",
                "Clojure Ate Scala (on my project) 45min",
                "Ruby vs. Clojure for Back-End Development 30min",
                "A World Without HackerNews 30min"
            };
            var conferenceStartDate = new DateTime(2018, 8, 24);
            var expectedOutputList  = new List <string>
            {
                "Track 1:",
                "09:00AM Writing Fast Tests Against Enterprise Rails 60min",
                "10:00AM Lua for the Masses 30min",
                "10:30AM Ruby Errors from Mismatched Gem Versions 45min",
                "11:15AM Accounting-Driven Development 45min",
                "12:00PM Lunch",
                "01:00PM Rails for Python Developers lightning",
                "01:05PM Sit Down and Write 30min",
                "01:35PM Rails Magic 60min",
                "02:35PM Clojure Ate Scala (on my project) 45min",
                "03:20PM Ruby vs. Clojure for Back-End Development 30min",
                "03:50PM A World Without HackerNews 30min",
                "05:00PM Networking Event"
            };

            //Action
            var conferencePlanner = new SimpleConferencePlanner(new TitleDurationSplitter());
            var conference        = conferencePlanner.PlanAConference(conferenceStartDate, inputTalkList);
            var actualOutputList  = new SimplePrintFormatter().GetPrintablePlan(conference);

            //Assert
            Assert.AreEqual(expectedOutputList, actualOutputList);
        }
Esempio n. 2
0
        public void IntegrationTestWithSample1()
        {
            //Arrange
            var inputTalkList = new List <string>
            {
                "Writing Fast Tests Against Enterprise Rails 60min",
                "Overdoing it in Python 45min",
                "Lua for the Masses 30min",
                "Ruby Errors from Mismatched Gem Versions 45min",
                "Common Ruby Errors 45min",
                "Rails for Python Developers lightning",
                "Communicating Over Distance 60min",
                "Accounting-Driven Development 45min",
                "Woah 30min",
                "Sit Down and Write 30min",
                "Pair Programming vs Noise 45min",
                "Rails Magic 60min",
                "Ruby on Rails: Why We Should Move On 60min",
                "Clojure Ate Scala (on my project) 45min",
                "Programming in the Boondocks of Seattle 30min",
                "Ruby vs. Clojure for Back-End Development 30min",
                "Ruby on Rails Legacy App Maintenance 60min",
                "A World Without HackerNews 30min",
                "User Interface CSS in Rails Apps 30min"
            };
            var conferenceStartDate = new DateTime(2018, 8, 24);
            var expectedOutputList  = new List <string>
            {
                "Track 1:",
                "09:00AM Writing Fast Tests Against Enterprise Rails 60min",
                "10:00AM Overdoing it in Python 45min",
                "10:45AM Lua for the Masses 30min",
                "11:15AM Ruby Errors from Mismatched Gem Versions 45min",
                "12:00PM Lunch",
                "01:00PM Common Ruby Errors 45min",
                "01:45PM Rails for Python Developers lightning",
                "01:50PM Communicating Over Distance 60min",
                "02:50PM Accounting-Driven Development 45min",
                "03:35PM Woah 30min",
                "04:05PM Sit Down and Write 30min",
                "05:00PM Networking Event",
                "Track 2:",
                "09:00AM Pair Programming vs Noise 45min",
                "09:45AM Rails Magic 60min",
                "10:45AM Ruby on Rails: Why We Should Move On 60min",
                "12:00PM Lunch",
                "01:00PM Clojure Ate Scala (on my project) 45min",
                "01:45PM Programming in the Boondocks of Seattle 30min",
                "02:15PM Ruby vs. Clojure for Back-End Development 30min",
                "02:45PM Ruby on Rails Legacy App Maintenance 60min",
                "03:45PM A World Without HackerNews 30min",
                "04:15PM User Interface CSS in Rails Apps 30min",
                "05:00PM Networking Event"
            };

            //Action
            var conferencePlanner = new SimpleConferencePlanner(new TitleDurationSplitter());
            var conference        = conferencePlanner.PlanAConference(conferenceStartDate, inputTalkList);
            var actualOutputList  = new SimplePrintFormatter().GetPrintablePlan(conference);

            //Assert
            Assert.AreEqual(expectedOutputList, actualOutputList);
        }
Esempio n. 3
0
        public void PlanAConferenceTest()
        {
            //Arrange
            var inputTalkList = new List <string>
            {
                "Writing Fast Tests Against Enterprise Rails 60min",
                "Lua for the Masses 30min",
                "Ruby Errors from Mismatched Gem Versions 45min",
                "Accounting-Driven Development 45min",
                "Rails for Python Developers lightning",
                "Sit Down and Write 30min",
                "Rails Magic 60min",
                "Clojure Ate Scala (on my project) 45min",
                "Ruby vs. Clojure for Back-End Development 30min",
                "A World Without HackerNews 30min"
            };
            var conferenceStartDate = new DateTime(2018, 8, 24);
            var talk1 = new Talk(
                "Writing Fast Tests Against Enterprise Rails",
                new Duration
            {
                DurationInTimeSpan       = new TimeSpan(1, 0, 0),
                DurationPortionFromTitle = "60min"
            });
            var talk2 = new Talk(
                "Lua for the Masses",
                new Duration
            {
                DurationInTimeSpan       = new TimeSpan(0, 30, 0),
                DurationPortionFromTitle = "30min"
            });
            var talk3 = new Talk(
                "Ruby Errors from Mismatched Gem Versions",
                new Duration
            {
                DurationInTimeSpan       = new TimeSpan(0, 45, 0),
                DurationPortionFromTitle = "45min"
            });
            var talk4 = new Talk(
                "Accounting-Driven Development",
                new Duration
            {
                DurationInTimeSpan       = new TimeSpan(0, 45, 0),
                DurationPortionFromTitle = "45min"
            });
            var talk5 = new Talk(
                "Rails for Python Developers",
                new Duration
            {
                DurationInTimeSpan       = new TimeSpan(0, 5, 0),
                DurationPortionFromTitle = "lightning"
            });
            var talk6 = new Talk(
                "Sit Down and Write",
                new Duration
            {
                DurationInTimeSpan       = new TimeSpan(0, 30, 0),
                DurationPortionFromTitle = "30min"
            });
            var talk7 = new Talk(
                "Rails Magic",
                new Duration
            {
                DurationInTimeSpan       = new TimeSpan(0, 60, 0),
                DurationPortionFromTitle = "60min"
            });
            var talk8 = new Talk(
                "Clojure Ate Scala (on my project)",
                new Duration
            {
                DurationInTimeSpan       = new TimeSpan(0, 45, 0),
                DurationPortionFromTitle = "45min"
            });
            var talk9 = new Talk(
                "Ruby vs. Clojure for Back-End Development",
                new Duration
            {
                DurationInTimeSpan       = new TimeSpan(0, 30, 0),
                DurationPortionFromTitle = "30min"
            });
            var talk10 = new Talk(
                "A World Without HackerNews",
                new Duration
            {
                DurationInTimeSpan       = new TimeSpan(0, 30, 0),
                DurationPortionFromTitle = "30min"
            });

            var morningTalkSession = new TalkSession(
                conferenceStartDate.Date + ConferenceSettings.MorningSessionStart,
                conferenceStartDate.Date + ConferenceSettings.MorningSessionEnd);
            var eveningTalkSession = new TalkSession(
                conferenceStartDate.Date + ConferenceSettings.EveningSessionStart,
                conferenceStartDate.Date + ConferenceSettings.EveningSessionEnd);

            talk1.StartTime = morningTalkSession.StartTime;
            morningTalkSession.AddATalk(talk1);
            talk2.StartTime = talk1.StartTime + talk1.Duration.DurationInTimeSpan;
            morningTalkSession.AddATalk(talk2);
            talk3.StartTime = talk2.StartTime + talk2.Duration.DurationInTimeSpan;
            morningTalkSession.AddATalk(talk3);
            talk4.StartTime = talk3.StartTime + talk3.Duration.DurationInTimeSpan;
            morningTalkSession.AddATalk(talk4);
            talk5.StartTime = eveningTalkSession.StartTime;
            eveningTalkSession.AddATalk(talk5);
            talk6.StartTime = talk5.StartTime + talk5.Duration.DurationInTimeSpan;
            eveningTalkSession.AddATalk(talk6);
            talk7.StartTime = talk6.StartTime + talk6.Duration.DurationInTimeSpan;
            eveningTalkSession.AddATalk(talk7);
            talk8.StartTime = talk7.StartTime + talk7.Duration.DurationInTimeSpan;
            eveningTalkSession.AddATalk(talk8);
            talk9.StartTime = talk8.StartTime + talk8.Duration.DurationInTimeSpan;
            eveningTalkSession.AddATalk(talk9);
            talk10.StartTime = talk9.StartTime + talk9.Duration.DurationInTimeSpan;
            eveningTalkSession.AddATalk(talk10);

            var track = new Track(conferenceStartDate);

            track.AddASession(morningTalkSession);
            track.AddASession(eveningTalkSession);

            var expectedConference = new Conference();

            expectedConference.AddATrack(track);

            //Action
            var conferencePlanner = new SimpleConferencePlanner(new TitleDurationSplitter());
            var actualConference  = conferencePlanner.PlanAConference(conferenceStartDate, inputTalkList);

            //Assert
            Assert.AreEqual(expectedConference.Tracks.Count, actualConference.Tracks.Count);
            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions.Count,
                            actualConference.Tracks[0].TalkSessions.Count);

            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[0].Talks.Count,
                            actualConference.Tracks[0].TalkSessions[0].Talks.Count);
            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[1].Talks.Count,
                            actualConference.Tracks[0].TalkSessions[1].Talks.Count);

            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[0].Talks[0].Title,
                            actualConference.Tracks[0].TalkSessions[0].Talks[0].Title);
            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[0].Talks[0].Duration.DurationPortionFromTitle,
                            actualConference.Tracks[0].TalkSessions[0].Talks[0].Duration.DurationPortionFromTitle);
            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[0].Talks[0].StartTime,
                            actualConference.Tracks[0].TalkSessions[0].Talks[0].StartTime);

            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[0].Talks[3].Title,
                            actualConference.Tracks[0].TalkSessions[0].Talks[3].Title);
            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[0].Talks[3].Duration.DurationPortionFromTitle,
                            actualConference.Tracks[0].TalkSessions[0].Talks[3].Duration.DurationPortionFromTitle);
            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[0].Talks[3].StartTime,
                            actualConference.Tracks[0].TalkSessions[0].Talks[3].StartTime);

            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[1].Talks[0].Title,
                            actualConference.Tracks[0].TalkSessions[1].Talks[0].Title);
            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[1].Talks[0].Duration.DurationPortionFromTitle,
                            actualConference.Tracks[0].TalkSessions[1].Talks[0].Duration.DurationPortionFromTitle);
            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[1].Talks[0].StartTime,
                            actualConference.Tracks[0].TalkSessions[1].Talks[0].StartTime);

            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[1].Talks[5].Title,
                            actualConference.Tracks[0].TalkSessions[1].Talks[5].Title);
            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[1].Talks[5].Duration.DurationPortionFromTitle,
                            actualConference.Tracks[0].TalkSessions[1].Talks[5].Duration.DurationPortionFromTitle);
            Assert.AreEqual(expectedConference.Tracks[0].TalkSessions[1].Talks[5].StartTime,
                            actualConference.Tracks[0].TalkSessions[1].Talks[5].StartTime);
        }