Ejemplo n.º 1
0
        public void CreateMessage3()
        {
            var message = new ConnectSessionMessage(TestHelpers.GetTestUser(1), "/connect qw");

            message.Sessionid.Should().Be(0);
            message.IsValid.Should().BeFalse();
        }
Ejemplo n.º 2
0
        public void CreateMessage()
        {
            var message = new ConnectSessionMessage(TestHelpers.GetTestUser(1), "/connect 12");

            message.Sessionid.Should().Be(12);
            message.IsValid.Should().BeTrue();
        }
        public void Test()
        {
            var results = new List <string>();

            for (int i = 0; i < 10; i++)
            {
                var session = new ScrumPokerSession(TestHelpers.GetTestUser(1), 1);
                session.AddUser(TestHelpers.GetTestUser(2));
                session.AddUser(TestHelpers.GetTestUser(3));
                session.AddUser(TestHelpers.GetTestUser(4));
                session.AddUser(TestHelpers.GetTestUser(5));
                session.AddUser(TestHelpers.GetTestUser(6));
                session.AddUser(TestHelpers.GetTestUser(7));
                session.AddUser(TestHelpers.GetTestUser(8));

                session.StartPoker();
                session.Estimate(TestHelpers.GetTestUser(1), 1);
                session.Estimate(TestHelpers.GetTestUser(2), 1);
                session.Estimate(TestHelpers.GetTestUser(3), 1);
                session.Estimate(TestHelpers.GetTestUser(4), 13);
                session.Estimate(TestHelpers.GetTestUser(5), 13);
                session.Estimate(TestHelpers.GetTestUser(6), 13);
                session.Estimate(TestHelpers.GetTestUser(7), 1);
                session.Estimate(TestHelpers.GetTestUser(8), 1);

                results.Add(session.Poker.ToString());
            }
        }
Ejemplo n.º 4
0
 public void Test1()
 {
     service.StartNewSession(TestHelpers.GetTestUser(1));
     service.ConnectToSession(TestHelpers.GetTestUser(2), 12);
     messageSender.Received()
     .InformaAddedUserAndMaster(Arg.Is <PokerUser>(p => p.ChatId == 2), Arg.Is <PokerUser>(p => p.ChatId == 1), 0);
 }
Ejemplo n.º 5
0
 public void StartPoker_NotMaster()
 {
     service.StartNewSession(TestHelpers.GetTestUser(123));
     service.ConnectToSession(TestHelpers.GetTestUser(124), 12);
     service.StartPoker(TestHelpers.GetTestUser(124), "");
     this.messageSender.Received().NotMasterUser(Arg.Any <PokerUser>());
 }
Ejemplo n.º 6
0
 public void StartPoker_WithoutExistingPoker()
 {
     service.StartNewSession(TestHelpers.GetTestUser(1));
     service.StartPoker(TestHelpers.GetTestUser(1), "");
     service.StartPoker(TestHelpers.GetTestUser(1), "");
     this.messageSender.Received().PokerAlreadyRunning(Arg.Is <long>(u => u == 1));
 }
Ejemplo n.º 7
0
        public void MessageTest3()
        {
            var message = new EstimationMessage(TestHelpers.GetTestUser(1), "asd Story Points");

            message.IsValid.Should().BeFalse();
            message.Estimation.Should().Be(0);
        }
Ejemplo n.º 8
0
        public void MessageTest1()
        {
            var message = new EstimationMessage(TestHelpers.GetTestUser(1), "1 Story Points");

            message.IsValid.Should().BeTrue();
            message.Estimation.Should().Be(1);
        }
Ejemplo n.º 9
0
        public void SendConnections()
        {
            service.StartNewSession(TestHelpers.GetTestUser(1));
            service.StartNewSession(TestHelpers.GetTestUser(2));

            service.SendConnections(TestHelpers.GetTestUser(3));
            this.messageSender.Received().SendConnections(Arg.Any <PokerUser>(), Arg.Is <ScrumPokerSession[]>(i => i.Any(s => s.Id == 12) && i.Any(s => s.Id == 13)));
        }
Ejemplo n.º 10
0
        public void AddUserToRunningSession()
        {
            service.StartNewSession(TestHelpers.GetTestUser(123));
            service.ConnectToSession(TestHelpers.GetTestUser(2), 12);
            service.ScrumPokerSessions.First().AllUsers.Length.Should().Be(2);

            messageSender.Received().InformaAddedUserAndMaster(Arg.Any <PokerUser>(), Arg.Any <PokerUser>(), 0);
        }
Ejemplo n.º 11
0
 private void TaksAddUsers2()
 {
     this.service.ConnectToSession(TestHelpers.GetTestUser(23), 2);
     this.service.ConnectToSession(TestHelpers.GetTestUser(24), 2);
     this.service.ConnectToSession(TestHelpers.GetTestUser(13), 1);
     this.service.ConnectToSession(TestHelpers.GetTestUser(14), 1);
     this.service.ConnectToSession(TestHelpers.GetTestUser(33), 3);
     this.service.ConnectToSession(TestHelpers.GetTestUser(34), 3);
 }
Ejemplo n.º 12
0
 private void TaksAddUsers3()
 {
     this.service.ConnectToSession(TestHelpers.GetTestUser(35), 3);
     this.service.ConnectToSession(TestHelpers.GetTestUser(36), 3);
     this.service.ConnectToSession(TestHelpers.GetTestUser(15), 1);
     this.service.ConnectToSession(TestHelpers.GetTestUser(16), 1);
     this.service.ConnectToSession(TestHelpers.GetTestUser(25), 2);
     this.service.ConnectToSession(TestHelpers.GetTestUser(26), 2);
 }
Ejemplo n.º 13
0
 private void TaksAddUsers()
 {
     this.service.ConnectToSession(TestHelpers.GetTestUser(11), 1);
     this.service.ConnectToSession(TestHelpers.GetTestUser(12), 1);
     this.service.ConnectToSession(TestHelpers.GetTestUser(21), 2);
     this.service.ConnectToSession(TestHelpers.GetTestUser(22), 2);
     this.service.ConnectToSession(TestHelpers.GetTestUser(31), 3);
     this.service.ConnectToSession(TestHelpers.GetTestUser(32), 3);
 }
Ejemplo n.º 14
0
        public void ShowAllUsers_MasterUser()
        {
            this.service.StartNewSession(TestHelpers.GetTestUser(1));
            this.service.ConnectToSession(TestHelpers.GetTestUser(2), 12);

            this.service.ShowAllUsers(TestHelpers.GetTestUser(1));

            this.messageSender.Received().SendUsers(Arg.Any <PokerUser[]>(), Arg.Any <PokerUser>());
        }
Ejemplo n.º 15
0
        public void Connect_WhenAlreadyConnected()
        {
            service.StartNewSession(TestHelpers.GetTestUser(1));
            service.ConnectToSession(TestHelpers.GetTestUser(2), 12);
            this.messageSender.ClearReceivedCalls();
            service.ConnectToSession(TestHelpers.GetTestUser(2), 12);

            messageSender.Received().AllreadyConnected(Arg.Any <PokerUser>());
        }
Ejemplo n.º 16
0
        public void CancelPoker()
        {
            service.StartNewSession(TestHelpers.GetTestUser(123));
            service.ConnectToSession(TestHelpers.GetTestUser(124), 12);

            service.StartPoker(TestHelpers.GetTestUser(123), "");
            service.CancelPoker(TestHelpers.GetTestUser(123));
            this.messageSender.Received().SendPokerResult(Arg.Any <ScrumPokerSession>(), Arg.Any <string>());
        }
Ejemplo n.º 17
0
        public void MasterUserLeaveSession()
        {
            service.StartNewSession(TestHelpers.GetTestUser(1));
            service.ConnectToSession(TestHelpers.GetTestUser(2), 12);

            service.LeaveSession(TestHelpers.GetTestUser(1));

            this.messageSender.Received().InformUserSessionEnded(Arg.Any <PokerUser[]>());
            this.service.ScrumPokerSessions.Count().Should().Be(0);
        }
Ejemplo n.º 18
0
        public void StartTwoSessions()
        {
            service.StartNewSession(TestHelpers.GetTestUser(123));
            service.StartNewSession(TestHelpers.GetTestUser(123));

            service.ScrumPokerSessions.Count().Should().Be(1);
            service.ScrumPokerSessions.First().AllUsers.Length.Should().Be(1);

            messageSender.Received().UserAlreadyInSession(Arg.Any <PokerUser>());
        }
Ejemplo n.º 19
0
        public void EndSession_ShouldInformUsers()
        {
            service.StartNewSession(TestHelpers.GetTestUser(123));
            service.ConnectToSession(TestHelpers.GetTestUser(2), 12);

            service.LeaveSession(TestHelpers.GetTestUser(2));

            service.ScrumPokerSessions.Count().Should().Be(1);
            messageSender.Received()
            .SendUserLeaveSession(Arg.Is <PokerUser>(u => u.ChatId == 123), Arg.Is <PokerUser>(u => u.ChatId == 2));
        }
Ejemplo n.º 20
0
        public void Estimate_WithoutRunningPoker()
        {
            service.StartNewSession(TestHelpers.GetTestUser(1));
            service.ConnectToSession(TestHelpers.GetTestUser(2), 12);
            service.ConnectToSession(TestHelpers.GetTestUser(3), 12);

            this.messageSender.ClearReceivedCalls();
            service.Estimate(TestHelpers.GetTestUser(1), 1);

            messageSender.Received().NoPokerRunning(Arg.Any <PokerUser>());
        }
Ejemplo n.º 21
0
        public void Estimation()
        {
            service.StartNewSession(TestHelpers.GetTestUser(1));
            service.ConnectToSession(TestHelpers.GetTestUser(2), 12);

            this.messageSender.ClearReceivedCalls();
            service.StartPoker(TestHelpers.GetTestUser(1), "");
            service.Estimate(TestHelpers.GetTestUser(1), 1);

            this.messageSender.DidNotReceive().SendPokerResult(Arg.Any <ScrumPokerSession>(), Arg.Any <string>());
            service.Estimate(TestHelpers.GetTestUser(2), 3);
            this.messageSender.Received().SendPokerResult(Arg.Any <ScrumPokerSession>(), Arg.Any <string>());
        }
Ejemplo n.º 22
0
        public void Connect_WhenAlreadyConnected2()
        {
            service.StartNewSession(TestHelpers.GetTestUser(1));
            service.StartNewSession(TestHelpers.GetTestUser(2));
            this.messageSender.ClearReceivedCalls();
            service.ConnectToSession(TestHelpers.GetTestUser(2), 12);

            var session1 = service.ScrumPokerSessions.First(s => s.Id == 12);
            var session2 = service.ScrumPokerSessions.First(s => s.Id == 13);

            session1.AllUsers.Count().Should().Be(1);
            session2.AllUsers.Count().Should().Be(1);

            messageSender.Received().AllreadyConnected(Arg.Any <PokerUser>());
        }
Ejemplo n.º 23
0
 private void Task1()
 {
     this.service.StartNewSession(TestHelpers.GetTestUser(10));
     this.service.StartNewSession(TestHelpers.GetTestUser(20));
     this.service.StartNewSession(TestHelpers.GetTestUser(30));
 }
Ejemplo n.º 24
0
 public void CancelPoker_withoutSession()
 {
     service.CancelPoker(TestHelpers.GetTestUser(123));
     this.messageSender.Received().NoSessionForUser(Arg.Any <PokerUser>());
 }
Ejemplo n.º 25
0
 public void SendConnections_withoutSessions()
 {
     service.SendConnections(TestHelpers.GetTestUser(3));
     this.messageSender.Received().NoRunningSession(Arg.Any <PokerUser>());
 }
Ejemplo n.º 26
0
 public void CancelPoker_withoutPokerSession()
 {
     service.StartNewSession(TestHelpers.GetTestUser(123));
     service.CancelPoker(TestHelpers.GetTestUser(123));
     this.messageSender.Received().NoPokerRunning(Arg.Any <PokerUser>());
 }
Ejemplo n.º 27
0
 public void StartNewSession_ShouldReturnsSessionid()
 {
     service.StartNewSession(TestHelpers.GetTestUser(123));
     service.ScrumPokerSessions.Count().Should().Be(1);
     service.ScrumPokerSessions.First().MasterUser.ChatId.Should().Be(123);
 }
        public void MessageTest1()
        {
            var message = new StartPokerMessage(TestHelpers.GetTestUser(1), "/poker qw");

            message.Description.Should().Be("qw");
        }
        public void MessageTest3()
        {
            var message = new StartPokerMessage(TestHelpers.GetTestUser(1), "/poker Enter BLI here");

            message.Description.Should().Be("Enter BLI here");
        }
Ejemplo n.º 30
0
 public void ConnectWithWrongId_InformsUser()
 {
     service.ConnectToSession(TestHelpers.GetTestUser(1), 1);
     messageSender.Received().NoSessionFound(Arg.Any <PokerUser>(), 1);
 }