Exemplo n.º 1
0
        public void Estimation_SetOnAllMembers_ObserverGetEstimationEndedMessage()
        {
            // Arrange
            var availableEstimations = DeckProvider.Default.GetDeck(Deck.Fibonacci);
            var team     = ScrumTeamTestData.CreateScrumTeam("test team", availableEstimations: availableEstimations);
            var master   = team.SetScrumMaster("master");
            var member   = (Member)team.Join("member", false);
            var observer = team.Join("observer", true);

            master.StartEstimation();
            var masterEstimation = new Estimation(21);
            var memberEstimation = new Estimation(34);

            // Act
            master.Estimation = masterEstimation;
            observer.ClearMessages();
            member.Estimation = memberEstimation;

            // Verify
            Assert.IsTrue(observer.HasMessage);
            Assert.AreEqual(2, observer.Messages.Count());
            var message = observer.Messages.Last();

            Assert.IsNotNull(message);
            Assert.AreEqual <MessageType>(MessageType.EstimationEnded, message.MessageType);
        }
Exemplo n.º 2
0
        public void Estimation_SetOnAllMembers_ScrumTeamGetEstimationEndedMessage()
        {
            // Arrange
            var availableEstimations = DeckProvider.Default.GetDeck(Deck.Fibonacci);
            var team   = ScrumTeamTestData.CreateScrumTeam("test team", availableEstimations: availableEstimations);
            var master = team.SetScrumMaster("master");
            var member = (Member)team.Join("member", false);

            master.StartEstimation();
            MessageReceivedEventArgs eventArgs = null;

            team.MessageReceived += new EventHandler <MessageReceivedEventArgs>((s, e) => eventArgs = e);
            var masterEstimation = new Estimation(55);
            var memberEstimation = new Estimation(55);

            // Act
            master.Estimation = masterEstimation;
            member.Estimation = memberEstimation;

            // Verify
            Assert.IsNotNull(eventArgs);
            var message = eventArgs.Message;

            Assert.IsNotNull(message);
            Assert.AreEqual <MessageType>(MessageType.EstimationEnded, message.MessageType);
        }
Exemplo n.º 3
0
        public void Estimation_SetOnAllMembersWithCustomValues_EstimationResultIsGenerated()
        {
            // Arrange
            var availableEstimations = ScrumTeamTestData.GetCustomEstimationDeck();
            var team   = ScrumTeamTestData.CreateScrumTeam("test team", availableEstimations: availableEstimations);
            var master = team.SetScrumMaster("master");
            var member = (Member)team.Join("member", false);

            master.StartEstimation();
            var masterEstimation = new Estimation(22.34);
            var memberEstimation = new Estimation(-100.2);

            // Act
            master.Estimation = masterEstimation;
            member.Estimation = memberEstimation;

            // Verify
            Assert.IsNotNull(team.EstimationResult);
            var expectedResult = new KeyValuePair <Member, Estimation>[]
            {
                new KeyValuePair <Member, Estimation>(master, masterEstimation),
                new KeyValuePair <Member, Estimation>(member, memberEstimation),
            };

            CollectionAssert.AreEquivalent(expectedResult, team.EstimationResult.ToList());
        }
Exemplo n.º 4
0
        public void Estimation_SetToNotAvailableValueWithCustomValues_ArgumentException()
        {
            // Arrange
            var availableEstimations = ScrumTeamTestData.GetCustomEstimationDeck();
            var team   = ScrumTeamTestData.CreateScrumTeam("test team", availableEstimations: availableEstimations);
            var master = team.SetScrumMaster("master");

            master.StartEstimation();
            var masterEstimation = new Estimation(double.PositiveInfinity);

            // Act
            Assert.ThrowsException <ArgumentException>(() => master.Estimation = masterEstimation);
        }
Exemplo n.º 5
0
        public void Estimation_SetToNotAvailableValueWithFibonacciValues_ArgumentException()
        {
            // Arrange
            var availableEstimations = DeckProvider.Default.GetDeck(Deck.Fibonacci);
            var team   = ScrumTeamTestData.CreateScrumTeam("test team", availableEstimations: availableEstimations);
            var master = team.SetScrumMaster("master");

            master.StartEstimation();
            var masterEstimation = new Estimation(40.0);

            // Act
            Assert.ThrowsException <ArgumentException>(() => master.Estimation = masterEstimation);
        }
Exemplo n.º 6
0
        private static ScrumTeam CreateScrumTeamWithMessages(Guid sessionId)
        {
            var team = ScrumTeamTestData.CreateScrumTeam("test team", guidProvider: new GuidProviderMock(sessionId));

            team.SetScrumMaster("test master");
            team.Join("test", true);
            var member = (Member)team.Join("test member", false);

            team.ScrumMaster.StartEstimation();
            member.Estimation           = team.AvailableEstimations.First(e => e.Value == 8);
            team.ScrumMaster.Estimation = team.AvailableEstimations.First(e => e.Value == 3);

            return(team);
        }
Exemplo n.º 7
0
        public void Estimation_SetTwiceAndGet_ReturnsTheValue()
        {
            // Arrange
            var availableEstimations = DeckProvider.Default.GetDeck(Deck.Fibonacci);
            var team       = ScrumTeamTestData.CreateScrumTeam("test team", availableEstimations: availableEstimations);
            var estimation = new Estimation(21);
            var target     = new Member(team, "test");

            // Act
            target.Estimation = estimation;
            target.Estimation = estimation;
            var result = target.Estimation;

            // Verify
            Assert.AreEqual <Estimation>(estimation, result);
        }
Exemplo n.º 8
0
        public void LastActivity_AfterConstruction_ReturnsUtcNow()
        {
            // Arrange
            var utcNow           = new DateTime(2012, 1, 2, 4, 50, 13);
            var dateTimeProvider = new DateTimeProviderMock();

            dateTimeProvider.SetUtcNow(utcNow);

            var team   = ScrumTeamTestData.CreateScrumTeam("test team", dateTimeProvider: dateTimeProvider);
            var target = new Observer(team, "test");

            // Act
            var result = target.LastActivity;

            // Verify
            Assert.AreEqual <DateTime>(utcNow, result);
        }
Exemplo n.º 9
0
        public void Estimation_SetOnMemberOnly_StateIsEstimationInProgress()
        {
            // Arrange
            var availableEstimations = DeckProvider.Default.GetDeck(Deck.Fibonacci);
            var team   = ScrumTeamTestData.CreateScrumTeam("test team", availableEstimations: availableEstimations);
            var master = team.SetScrumMaster("master");
            var member = (Member)team.Join("member", false);

            master.StartEstimation();
            var masterEstimation = new Estimation(89);

            // Act
            master.Estimation = masterEstimation;

            // Verify
            Assert.AreEqual <TeamState>(TeamState.EstimationInProgress, team.State);
        }
Exemplo n.º 10
0
        public void UpdateActivity_UtcNowIsChanged_LastActivityIsChanged()
        {
            // Arrange
            var utcNow           = new DateTime(2012, 1, 2, 4, 50, 13);
            var dateTimeProvider = new DateTimeProviderMock();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 2, 3, 35, 0));

            var team   = ScrumTeamTestData.CreateScrumTeam("test team", dateTimeProvider: dateTimeProvider);
            var target = new Observer(team, "test");

            dateTimeProvider.SetUtcNow(utcNow);

            // Act
            target.UpdateActivity();
            var result = target.LastActivity;

            // Verify
            Assert.AreEqual <DateTime>(utcNow, result);
        }
Exemplo n.º 11
0
        public void ClearMessages_AfterAcknowledge_HasNoMessages()
        {
            // Arrange
            var sessionId = Guid.NewGuid();
            var team      = ScrumTeamTestData.CreateScrumTeam("test team", guidProvider: new GuidProviderMock(sessionId));
            var master    = team.SetScrumMaster("master");
            var target    = team.Join("test", true);

            master.StartEstimation();
            master.CancelEstimation();

            // Act
            target.AcknowledgeMessages(sessionId, 2);
            var result = target.ClearMessages();

            // Verify
            Assert.AreEqual <long>(2, result);
            Assert.IsFalse(target.HasMessage);
            Assert.AreEqual <long>(result, target.AcknowledgedMessageId);
        }