public void Create_ConferenceWithTalkInAfternoon_ReturnsConference()
        {
            // Arrange
            var conferenceId    = Guid.NewGuid();
            var trackId         = Guid.NewGuid();
            var talkIdAfternoon = Guid.NewGuid();

            var conferenceIdObj = ConferenceId.Create(conferenceId).Data;
            var conference      = Conference.Create(conferenceIdObj).Data;
            var trackIdObj      = TrackId.Create(trackId).Data;

            conference.AddTrack(trackIdObj);

            AddTalkToTrack(conference, trackIdObj, Guid.NewGuid(), "Morning - 1", "1st Morning Session 60 mins", 60);
            AddTalkToTrack(conference, trackIdObj, Guid.NewGuid(), "Morning - 2", "2nd Morning Session 60 mins", 60);
            AddTalkToTrack(conference, trackIdObj, Guid.NewGuid(), "Morning - 3", "3rd Morning Session 60 mins", 60);

            var talkIdObjAfternoon   = TalkId.Create(talkIdAfternoon).Data;
            var titleAfternoon       = Title.Create("Afternoon talk").Data;
            var descriptionAfternoon = Description.Create("This is the Afternoon talk").Data;
            var durationAfternoon    = Duration.Create(TimeSpan.FromMinutes(45)).Data;         // 45 mins
            var startTimeAfternoon   = TalkStartTime.Create(DateTime.Today.AddHours(13)).Data; // 1PM

            // Act
            var afternoonTalkAddedToTrackEventResult = conference.AddTalkToTrack(trackIdObj, talkIdObjAfternoon, titleAfternoon, descriptionAfternoon, durationAfternoon);

            // Assert
            Assert.IsTrue(afternoonTalkAddedToTrackEventResult.IsSuccess);
            var talkAddedToTrackEvent = conference.Events.OfType <TalkAddedToTrack>().LastOrDefault();

            Assert.IsNotNull(talkAddedToTrackEvent);
            Assert.AreEqual(trackIdObj, talkAddedToTrackEvent.TrackId);
            Assert.AreEqual(talkIdObjAfternoon, talkAddedToTrackEvent.TalkId);
            Assert.AreEqual(startTimeAfternoon, talkAddedToTrackEvent.StartTime);
        }
        public void Create_StartTimeAfterLunchHour_ReturnsSuccess()
        {
            // Greater than 1 PM
            var afterLunchHourStartTimeResult = TalkStartTime.Create(DateTime.Today.AddHours(13).AddMinutes(0));

            Assert.IsTrue(afterLunchHourStartTimeResult.IsSuccess);
        }
        public void Create_StartTimeBeforeLunchHour_ReturnsSuccess()
        {
            // Less than 12 Noon
            var beforeLunchHourStartTimeResult = TalkStartTime.Create(DateTime.Today.AddHours(11).AddMinutes(59));

            Assert.IsTrue(beforeLunchHourStartTimeResult.IsSuccess);
        }
        public void Create_ConferenceWithTalkInMorning_ReturnsConference()
        {
            // Arrange
            var conferenceId = Guid.NewGuid();
            var trackId      = Guid.NewGuid();
            var talkId       = Guid.NewGuid();

            var conferenceIdObj        = ConferenceId.Create(conferenceId).Data;
            var trackIdObj             = TrackId.Create(trackId).Data;
            var talkIdObj              = TalkId.Create(talkId).Data;
            var title                  = Title.Create("First talk").Data;
            var description            = Description.Create("This is the first talk").Data;
            var duration               = Duration.Create(TimeSpan.FromMinutes(30)).Data;        // 30 minutes
            var morningSessionDateTime = TalkStartTime.Create(DateTime.Today.AddHours(9)).Data; // 9AM

            var conference = Conference.Create(conferenceIdObj).Data;

            conference.AddTrack(trackIdObj);

            // Act
            var addTalkToTrackResult = conference.AddTalkToTrack(trackIdObj, talkIdObj, title, description, duration);

            // Assert
            Assert.IsTrue(addTalkToTrackResult.IsSuccess);
            var talkAddedToTrackEvent = conference.Events.OfType <TalkAddedToTrack>().FirstOrDefault();

            Assert.IsNotNull(talkAddedToTrackEvent);
            Assert.AreEqual(trackIdObj, talkAddedToTrackEvent.TrackId);
            Assert.AreEqual(talkIdObj, talkAddedToTrackEvent.TalkId);
            Assert.AreEqual(morningSessionDateTime, talkAddedToTrackEvent.StartTime);
            Assert.IsNull(addTalkToTrackResult.Error);
        }
        public void Create_StartTimeBeforeMorningSession_ReturnFailure()
        {
            var createStartTimeBeforeMorningSessionResult = TalkStartTime.Create(DateTime.Today.AddHours(8));

            Assert.AreEqual(true, createStartTimeBeforeMorningSessionResult.IsFailure);
            Assert.AreEqual(ErrorCodes.Invalid.ToString(), createStartTimeBeforeMorningSessionResult.Error.Value.Code);
            Assert.AreEqual("Invalid start time", createStartTimeBeforeMorningSessionResult.Error.Value.Message);
        }
        public void Create_StartTimeWithinNetworkingEvent_ReturnsFailure()
        {
            var withinNetworkingEventStartTimeResult = TalkStartTime.Create(DateTime.Today.AddHours(16).AddMinutes(1));

            Assert.IsTrue(withinNetworkingEventStartTimeResult.IsFailure);

            withinNetworkingEventStartTimeResult = TalkStartTime.Create(DateTime.Today.AddHours(16).AddMinutes(59));
            Assert.IsTrue(withinNetworkingEventStartTimeResult.IsFailure);
        }
        public void Create_StartTimeWithinNetworkingEvent_ReturnFailure()
        {
            var createStartTimeWithinLunchResult = TalkStartTime.Create(DateTime.Today.AddHours(16).AddMinutes(1));

            Assert.AreEqual(true, createStartTimeWithinLunchResult.IsFailure);

            createStartTimeWithinLunchResult = TalkStartTime.Create(DateTime.Today.AddHours(17).AddMinutes(59));
            Assert.AreEqual(true, createStartTimeWithinLunchResult.IsFailure);
        }
        public void Create_StartTimeWithinAfternoonSession_ReturnSuccess()
        {
            var createStartTimeWithinAfternoonSessionResult = TalkStartTime.Create(DateTime.Today.AddHours(13));

            Assert.AreEqual(true, createStartTimeWithinAfternoonSessionResult.IsSuccess);

            createStartTimeWithinAfternoonSessionResult = TalkStartTime.Create(DateTime.Today.AddHours(15).AddMinutes(59));
            Assert.AreEqual(true, createStartTimeWithinAfternoonSessionResult.IsSuccess);
        }
        public void Create_StartTimeWithinLunchHour_ReturnsFailure()
        {
            // After 12PM
            var withinLunchHourStartTimeResult = TalkStartTime.Create(DateTime.Today.AddHours(12).AddMinutes(1));

            Assert.IsTrue(withinLunchHourStartTimeResult.IsFailure);

            // Before 1 PM
            withinLunchHourStartTimeResult = TalkStartTime.Create(DateTime.Today.AddHours(12).AddMinutes(59));
            Assert.IsTrue(withinLunchHourStartTimeResult.IsFailure);
        }
        public void Create_StartTimeAfterNetworkingEvent_ReturnsFailure()
        {
            var afterNetworkingEventStartTimeResult = TalkStartTime.Create(DateTime.Today.AddHours(17).AddMinutes(1));

            Assert.IsTrue(afterNetworkingEventStartTimeResult.IsFailure);
        }
        public void Create_StartTimeBeforeNetworkingEvent_ReturnsSuccess()
        {
            var beforeNetworkingEventStartTimeResult = TalkStartTime.Create(DateTime.Today.AddHours(15).AddMinutes(59));

            Assert.IsTrue(beforeNetworkingEventStartTimeResult.IsSuccess);
        }