Exemple #1
0
        public void OnlyReturnSelectedSessionsForTheSpecifiedSpeaker()
        {
            var session1 = new Session {
                SpeakerUserName = "******", SessionId = 1
            };
            var session2 = new Session {
                SpeakerUserName = "******", SessionId = 2
            };
            var session3 = new Session {
                SpeakerUserName = "******", SessionId = 3
            };

            var sessionRepository = Substitute.For <ISessionRepository>();

            sessionRepository.GetSessionsSubmittedBy("bob").Returns(new[] { session1, session3 });

            var selectedSessionIds = new[] { session1.SessionId, session2.SessionId, session3.SessionId };
            var sessionsLoader     = new SelectedSessionsLoader(sessionRepository, selectedSessionIds);

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

            Assert.That(sessions, Is.EquivalentTo(new[] { session1, session3 }));
        }
Exemple #2
0
        public void ThrowAnException_WhenGivenANullProfile()
        {
            var sessionRepository = Substitute.For <ISessionRepository>();
            var sessionsLoader    = new SelectedSessionsLoader(sessionRepository, new int[0]);

            Assert.Throws <ArgumentNullException>(() => sessionsLoader.LoadSessions(null));
        }
Exemple #3
0
        public void OnlyReturnSessionsForTheSpecifiedSpeaker()
        {
            var sessionRepository = Substitute.For <ISessionRepository>();
            var sessionsLoader    = new SelectedSessionsLoader(sessionRepository, new int[0]);

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

            sessionRepository.Received().GetSessionsSubmittedBy("bob");
        }