Пример #1
0
        public void JoinTeam_TeamNameAndObserverNameAsObserver_ReturnsTeamJoined()
        {
            // Arrange
            var team          = CreateBasicTeam();
            var teamLock      = CreateTeamLock(team);
            var planningPoker = new Mock <D.IPlanningPoker>(MockBehavior.Strict);

            planningPoker.Setup(p => p.GetScrumTeam(TeamName)).Returns(teamLock.Object).Verifiable();
            var target = new PlanningPokerService(planningPoker.Object);

            // Act
            var result = target.JoinTeam(TeamName, ObserverName, true).Value;

            // Verify
            planningPoker.Verify();
            teamLock.Verify();
            teamLock.Verify(l => l.Team);

            Assert.IsNotNull(result);
            Assert.AreEqual <string>(TeamName, result.Name);
            Assert.IsNotNull(result.ScrumMaster);
            Assert.AreEqual <string>(ScrumMasterName, result.ScrumMaster.Name);
            Assert.IsNotNull(result.Observers);
            var expectedObservers = new string[] { ObserverName };

            CollectionAssert.AreEquivalent(expectedObservers, result.Observers.Select(m => m.Name).ToList());
            var expectedMemberTypes = new string[] { typeof(D.Observer).Name };

            CollectionAssert.AreEquivalent(expectedMemberTypes, result.Observers.Select(m => m.Type).ToList());
        }
Пример #2
0
        public void JoinTeam_MemberNameTooLong_ArgumentException()
        {
            // Arrange
            var planningPoker = new Mock <D.IPlanningPoker>(MockBehavior.Strict);
            var target        = new PlanningPokerService(planningPoker.Object);

            // Act
            target.JoinTeam(TeamName, LongMemberName, false);
        }
Пример #3
0
        public void JoinTeam_TeamNameIsEmpty_ArgumentNullException()
        {
            // Arrange
            var planningPoker = new Mock <D.IPlanningPoker>(MockBehavior.Strict);
            var target        = new PlanningPokerService(planningPoker.Object);

            // Act
            target.JoinTeam(null, MemberName, false);
        }
Пример #4
0
        public void JoinTeam_TeamNameAndObserverNameAsObserver_ObserverIsAddedToTheTeam()
        {
            // Arrange
            var team          = CreateBasicTeam();
            var teamLock      = CreateTeamLock(team);
            var planningPoker = new Mock <D.IPlanningPoker>(MockBehavior.Strict);

            planningPoker.Setup(p => p.GetScrumTeam(TeamName)).Returns(teamLock.Object).Verifiable();
            var target = new PlanningPokerService(planningPoker.Object);

            // Act
            target.JoinTeam(TeamName, ObserverName, true);

            // Verify
            var expectedObservers = new string[] { ObserverName };

            CollectionAssert.AreEquivalent(expectedObservers, team.Observers.Select(m => m.Name).ToList());
        }
Пример #5
0
        public void JoinTeam_TeamNameAndMemberNameAsMemberAndEstimationStarted_ScrumMasterIsEstimationParticipant()
        {
            // Arrange
            var team = CreateBasicTeam();

            team.ScrumMaster.StartEstimation();
            var teamLock      = CreateTeamLock(team);
            var planningPoker = new Mock <D.IPlanningPoker>(MockBehavior.Strict);

            planningPoker.Setup(p => p.GetScrumTeam(TeamName)).Returns(teamLock.Object).Verifiable();
            var target = new PlanningPokerService(planningPoker.Object);

            // Act
            target.JoinTeam(TeamName, MemberName, false);

            // Verify
            var expectedParticipants = new string[] { ScrumMasterName };

            CollectionAssert.AreEquivalent(expectedParticipants, team.EstimationParticipants.Select(m => m.MemberName).ToList());
        }