Esempio n. 1
0
        public async Task ProcessMessages_MemberJoinedWithMember_2Members()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();
            var target    = CreateController(propertyChangedCounter);
            await target.InitializeTeam(CreateTeamResult(scrumTeam), PlanningPokerData.ScrumMasterName);

            var message = new MemberMessage
            {
                Id     = 0,
                Type   = MessageType.MemberJoined,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.MemberType,
                    Name = "New member"
                }
            };

            ProcessMessage(target, message);

            Assert.AreEqual(1, propertyChangedCounter.Count);
            Assert.AreEqual(0, target.LastMessageId);
            var expectedMembers = new string[] { "New member", PlanningPokerData.MemberName };

            CollectionAssert.AreEqual(expectedMembers, target.Members.Select(m => m.Name).ToList());
            expectedMembers = new string[] { PlanningPokerData.ObserverName };
            CollectionAssert.AreEqual(expectedMembers, target.Observers.Select(m => m.Name).ToList());
            PlanningPokerControllerTest.AssertNoMemberHasEstimated(target);
        }
Esempio n. 2
0
        public async Task ProcessMessages_EstimationCanceled_StateIsEstimationCanceled()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();

            scrumTeam.State = TeamState.EstimationInProgress;
            var target = CreateController(propertyChangedCounter);
            await target.InitializeTeam(CreateTeamResult(scrumTeam), PlanningPokerData.ScrumMasterName);

            var message = new Message
            {
                Id   = 4,
                Type = MessageType.EstimationCanceled
            };

            ProcessMessage(target, message);

            Assert.AreEqual(1, propertyChangedCounter.Count);
            Assert.AreEqual(4, target.LastMessageId);
            Assert.AreEqual(TeamState.EstimationCanceled, target.ScrumTeam.State);
            Assert.IsFalse(target.CanSelectEstimation);
            Assert.IsTrue(target.CanStartEstimation);
            Assert.IsFalse(target.CanCancelEstimation);
            PlanningPokerControllerTest.AssertNoMemberHasEstimated(target);
        }
Esempio n. 3
0
        public async Task ProcessMessages_2xMemberJoinedWithMember_3Members()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();

            scrumTeam.State = TeamState.EstimationInProgress;
            var target = CreateController(propertyChangedCounter);
            await target.InitializeTeam(CreateTeamResult(scrumTeam), PlanningPokerData.ScrumMasterName);

            var message1 = new MemberMessage
            {
                Id     = 1,
                Type   = MessageType.MemberJoined,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.MemberType,
                    Name = "XYZ"
                }
            };
            var message2 = new MemberMessage
            {
                Id     = 2,
                Type   = MessageType.MemberJoined,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.MemberType,
                    Name = "New member"
                }
            };

            target.ProcessMessages(new Message[] { message1, message2 });

            Assert.AreEqual(2, propertyChangedCounter.Count);
            Assert.AreEqual(2, target.LastMessageId);
            var expectedMembers = new string[] { "New member", PlanningPokerData.MemberName, "XYZ" };

            CollectionAssert.AreEqual(expectedMembers, target.Members.Select(m => m.Name).ToList());
            expectedMembers = new string[] { PlanningPokerData.ObserverName };
            CollectionAssert.AreEqual(expectedMembers, target.Observers.Select(m => m.Name).ToList());
            PlanningPokerControllerTest.AssertNoMemberHasEstimated(target);
        }
Esempio n. 4
0
        public async Task ProcessMessages_EstimationEndedAndSameEstimationCountWithNull_6Estimations()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();

            scrumTeam.Members.Add(new TeamMember {
                Type = PlanningPokerData.MemberType, Name = "Developer 1"
            });
            scrumTeam.Members.Add(new TeamMember {
                Type = PlanningPokerData.MemberType, Name = "Developer 2"
            });
            scrumTeam.Members.Add(new TeamMember {
                Type = PlanningPokerData.MemberType, Name = "Tester 1"
            });
            scrumTeam.Members.Add(new TeamMember {
                Type = PlanningPokerData.MemberType, Name = "Tester 2"
            });
            var target = CreateController(propertyChangedCounter);
            await target.InitializeTeam(CreateTeamResult(scrumTeam), PlanningPokerData.MemberName);

            var message = new EstimationResultMessage
            {
                Id               = 10,
                Type             = MessageType.EstimationEnded,
                EstimationResult = new List <EstimationResultItem>
                {
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.ScrumMasterType, Name = PlanningPokerData.ScrumMasterName
                        },
                        Estimation = new Estimation {
                            Value = double.PositiveInfinity
                        }
                    },
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.MemberType, Name = "Developer 2"
                        },
                        Estimation = new Estimation {
                            Value = null
                        }
                    },
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.MemberType, Name = "Tester 1"
                        },
                        Estimation = new Estimation {
                            Value = null
                        }
                    },
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.MemberType, Name = PlanningPokerData.MemberName
                        },
                        Estimation = new Estimation {
                            Value = double.PositiveInfinity
                        }
                    },
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.MemberType, Name = "Developer 1"
                        },
                        Estimation = new Estimation {
                            Value = 5
                        }
                    },
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.MemberType, Name = "Tester 2"
                        },
                        Estimation = new Estimation {
                            Value = 5
                        }
                    }
                }
            };

            StartEstimation(target);
            ProcessMessage(target, message);

            Assert.AreEqual(2, propertyChangedCounter.Count);
            Assert.AreEqual(10, target.LastMessageId);
            Assert.AreEqual(TeamState.EstimationFinished, target.ScrumTeam.State);
            Assert.IsFalse(target.CanSelectEstimation);
            Assert.IsFalse(target.CanStartEstimation);
            Assert.IsFalse(target.CanCancelEstimation);
            PlanningPokerControllerTest.AssertNoMemberHasEstimated(target);

            var estimations = target.Estimations.ToList();

            Assert.AreEqual(6, estimations.Count);

            var estimation = estimations[0];

            Assert.AreEqual("Developer 1", estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.AreEqual(5.0, estimation.Estimation);

            estimation = estimations[1];
            Assert.AreEqual("Tester 2", estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.AreEqual(5.0, estimation.Estimation);

            estimation = estimations[2];
            Assert.AreEqual(PlanningPokerData.MemberName, estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.AreEqual(double.PositiveInfinity, estimation.Estimation);

            estimation = estimations[3];
            Assert.AreEqual(PlanningPokerData.ScrumMasterName, estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.AreEqual(double.PositiveInfinity, estimation.Estimation);

            estimation = estimations[4];
            Assert.AreEqual("Developer 2", estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.IsNull(estimation.Estimation);

            estimation = estimations[5];
            Assert.AreEqual("Tester 1", estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.IsNull(estimation.Estimation);
        }
Esempio n. 5
0
        public async Task ProcessMessages_EstimationEnded_5Estimations()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();

            scrumTeam.Members.Add(new TeamMember {
                Type = PlanningPokerData.MemberType, Name = "Developer 1"
            });
            scrumTeam.Members.Add(new TeamMember {
                Type = PlanningPokerData.MemberType, Name = "Tester"
            });
            scrumTeam.Members.Add(new TeamMember {
                Type = PlanningPokerData.MemberType, Name = "Developer 2"
            });
            var target = CreateController(propertyChangedCounter);
            await target.InitializeTeam(CreateTeamResult(scrumTeam), PlanningPokerData.ScrumMasterName);

            var message1 = new MemberMessage
            {
                Id     = 5,
                Type   = MessageType.MemberEstimated,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.MemberType,
                    Name = "Developer 1"
                }
            };
            var message2 = new MemberMessage
            {
                Id     = 6,
                Type   = MessageType.MemberEstimated,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.MemberType,
                    Name = PlanningPokerData.MemberName
                }
            };
            var message3 = new MemberMessage
            {
                Id     = 7,
                Type   = MessageType.MemberEstimated,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.ScrumMasterType,
                    Name = PlanningPokerData.ScrumMasterName
                }
            };
            var message4 = new MemberMessage
            {
                Id     = 8,
                Type   = MessageType.MemberEstimated,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.MemberType,
                    Name = "Tester"
                }
            };
            var message5 = new MemberMessage
            {
                Id     = 9,
                Type   = MessageType.MemberEstimated,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.MemberType,
                    Name = "Developer 2"
                }
            };

            var message = new EstimationResultMessage
            {
                Id               = 10,
                Type             = MessageType.EstimationEnded,
                EstimationResult = new List <EstimationResultItem>
                {
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.MemberType, Name = "Developer 1"
                        },
                        Estimation = new Estimation {
                            Value = 8
                        }
                    },
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.MemberType, Name = "Tester"
                        },
                        Estimation = new Estimation {
                            Value = 8
                        }
                    },
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.ScrumMasterType, Name = PlanningPokerData.ScrumMasterName
                        },
                        Estimation = new Estimation {
                            Value = 3
                        }
                    },
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.MemberType, Name = PlanningPokerData.MemberName
                        },
                        Estimation = new Estimation {
                            Value = 8
                        }
                    },
                    new EstimationResultItem
                    {
                        Member = new TeamMember {
                            Type = PlanningPokerData.MemberType, Name = "Developer 2"
                        },
                        Estimation = new Estimation {
                            Value = 2
                        }
                    }
                }
            };

            StartEstimation(target);
            ProcessMessage(target, message1);
            target.ProcessMessages(new Message[] { message2, message3, message4 });
            target.ProcessMessages(new Message[] { message5, message });

            Assert.AreEqual(7, propertyChangedCounter.Count);
            Assert.AreEqual(10, target.LastMessageId);
            Assert.AreEqual(TeamState.EstimationFinished, target.ScrumTeam.State);
            Assert.IsFalse(target.CanSelectEstimation);
            Assert.IsTrue(target.CanStartEstimation);
            Assert.IsFalse(target.CanCancelEstimation);
            PlanningPokerControllerTest.AssertNoMemberHasEstimated(target);

            var estimations = target.Estimations.ToList();

            Assert.AreEqual(5, estimations.Count);

            var estimation = estimations[0];

            Assert.AreEqual("Developer 1", estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.AreEqual(8.0, estimation.Estimation);

            estimation = estimations[1];
            Assert.AreEqual(PlanningPokerData.MemberName, estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.AreEqual(8.0, estimation.Estimation);

            estimation = estimations[2];
            Assert.AreEqual("Tester", estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.AreEqual(8.0, estimation.Estimation);

            estimation = estimations[3];
            Assert.AreEqual("Developer 2", estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.AreEqual(2.0, estimation.Estimation);

            estimation = estimations[4];
            Assert.AreEqual(PlanningPokerData.ScrumMasterName, estimation.MemberName);
            Assert.IsTrue(estimation.HasEstimation);
            Assert.AreEqual(3.0, estimation.Estimation);
        }