public void OnlyReturnSessionsForTheSpecifiedSpeaker()
        {
            var sessionRepository = Substitute.For<ISessionRepository>();
            var sessionsLoader = new SelectedSessionsLoader(sessionRepository);

            sessionsLoader.LoadSessions(new UserProfile {UserName = "******"});

            sessionRepository.Received().GetSessionsSubmittedBy("bob");
        }
        public void OnlyReturnSelectedSessionsForTheSpecifiedSpeaker()
        {
            var sessionRepository = Substitute.For<ISessionRepository>();
            var session1 = new Session {SpeakerUserName = "******", SessionId = 123456};
            var session3 = new Session {SpeakerUserName = "******", SessionId = 102};
            sessionRepository.GetSessionsSubmittedBy("bob").Returns(new[] { session1, new Session { SpeakerUserName = "******" }, session3 });
            var sessionsLoader = new SelectedSessionsLoader(sessionRepository);

            var sessions = sessionsLoader.LoadSessions(new UserProfile {UserName = "******"});

            Assert.That(sessions, Is.EquivalentTo(new[] {session3}));
        }
        public ISessionLoader Create(IConference conference)
        {
            ISessionLoader sessionLoader;

            if (conference.CanPublishAgenda())
            {
                sessionLoader = new SelectedSessionsLoader(sessionRepository);
            }
            else
            {
                sessionLoader = new AllSessionsLoader(sessionRepository);
            }

            return sessionLoader;
        }
Esempio n. 4
0
        public ISessionLoader Create(IConference conference)
        {
            ISessionLoader sessionLoader;

            if (conference.CanPublishAgenda())
            {
                sessionLoader = new SelectedSessionsLoader(sessionRepository, SelectedSessions.SessionIds);
            }
            else
            {
                sessionLoader = new AllSessionsLoader(sessionRepository);
            }

            return(sessionLoader);
        }
 public void ThrowAnException_WhenGivenANullProfile()
 {
     var sessionRepository = Substitute.For<ISessionRepository>();
     var sessionsLoader = new SelectedSessionsLoader(sessionRepository);
     Assert.Throws<ArgumentNullException>(() => sessionsLoader.LoadSessions(null));
 }