Beispiel #1
0
        public void Estimation_SetOnAllMembers_ObserverGetEstimationEndedMessage()
        {
            // Arrange
            var team     = new ScrumTeam("test team");
            var master   = team.SetScrumMaster("master");
            var member   = (Member)team.Join("member", false);
            var observer = team.Join("observer", true);

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

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

            // Verify
            Assert.IsTrue(observer.HasMessage);
            observer.PopMessage();
            Assert.IsTrue(observer.HasMessage);
            var message = observer.PopMessage();

            Assert.IsNotNull(message);
            Assert.AreEqual <MessageType>(MessageType.EstimationEnded, message.MessageType);
            Assert.IsFalse(observer.HasMessage);
        }
Beispiel #2
0
        public void Estimation_SetOnMemberOnly_ObserverGetsMemberEstimatedMessage()
        {
            // Arrange
            var team     = new ScrumTeam("test team");
            var master   = team.SetScrumMaster("master");
            var member   = (Member)team.Join("member", false);
            var observer = team.Join("observer", true);

            master.StartEstimation();
            TestHelper.ClearMessages(observer);
            var memberEstimation = new Estimation();

            // Act
            member.Estimation = memberEstimation;

            // Verify
            Assert.IsTrue(observer.HasMessage);
            var message = observer.PopMessage();

            Assert.AreEqual <MessageType>(MessageType.MemberEstimated, message.MessageType);
            Assert.IsInstanceOfType(message, typeof(MemberMessage));
            var memberMessage = (MemberMessage)message;

            Assert.AreEqual <Observer>(member, memberMessage.Member);
        }
Beispiel #3
0
        public void Estimation_SetOnAllMembers_EstimationResultIsGeneratedForObserver()
        {
            // Arrange
            var team     = new ScrumTeam("test team");
            var master   = team.SetScrumMaster("master");
            var member   = (Member)team.Join("member", false);
            var observer = team.Join("observer", true);

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

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

            // Verify
            observer.PopMessage();
            var message = observer.PopMessage();

            Assert.IsInstanceOfType(message, typeof(EstimationResultMessage));
            var estimationResultMessage = (EstimationResultMessage)message;

            Assert.AreEqual <EstimationResult>(team.EstimationResult, estimationResultMessage.EstimationResult);
        }
Beispiel #4
0
        public void DisconnectInactiveObservers_ActiveObserverAndInactiveMember_ObserverMessageReceived()
        {
            // Arrange
            var dateTimeProvider = new DateTimeProviderMock();

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

            var target = new ScrumTeam("test team", dateTimeProvider);
            var master = target.SetScrumMaster("master");
            var member = target.Join("member", false);

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 30));
            var       observer  = target.Join("observer", true);
            EventArgs eventArgs = null;

            observer.MessageReceived += new EventHandler((s, e) => eventArgs = e);

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

            // Act
            target.DisconnectInactiveObservers(TimeSpan.FromSeconds(30.0));

            // Verify
            Assert.IsNotNull(eventArgs);
            Assert.IsTrue(observer.HasMessage);
            var message = observer.PopMessage();

            Assert.AreEqual <MessageType>(MessageType.MemberDisconnected, message.MessageType);
        }
        public void SerializeAndDeserialize_ReceivedMessages_MessageHasNextId()
        {
            // Arrange
            var team   = new ScrumTeam("test");
            var master = team.SetScrumMaster("master");

            team.Join("member", false);
            team.Join("observer", true);
            master.StartEstimation();

            var lastMessage = master.Messages.Last();

            master.ClearMessages();

            // Act
            var result = VerifySerialization(team);

            // Verify
            var member = (Member)result.FindMemberOrObserver("member");

            member.Estimation = result.AvailableEstimations.First(e => e.Value == 5);

            Assert.IsTrue(result.ScrumMaster.HasMessage);
            var message = result.ScrumMaster.Messages.First();

            Assert.AreEqual(lastMessage.Id + 1, message.Id);
        }
Beispiel #6
0
        public void Join_AsObserverAndObserverWithNameExists_ArgumentException()
        {
            // Arrange
            var name   = "test";
            var target = new ScrumTeam("test team");

            target.Join(name, true);

            // Act
            var result = target.Join(name, true);
        }
Beispiel #7
0
        public void Join_AsMemberWhenObserverExists_MemberDoesNotGetMessage()
        {
            // Arrange
            var target   = new ScrumTeam("test team");
            var master   = target.SetScrumMaster("master");
            var observer = target.Join("observer", true);

            // Act
            var result = target.Join("member", false);

            // Verify
            Assert.IsFalse(result.HasMessage);
        }
Beispiel #8
0
        public void Join_SetNameAndIsObserverTwice_ObserversAreInObserversCollection()
        {
            // Arrange
            var name1  = "test1";
            var name2  = "test2";
            var target = new ScrumTeam("test team");

            // Act
            var result1 = target.Join(name1, true);
            var result2 = target.Join(name2, true);

            // Verify
            CollectionAssert.AreEquivalent(new Observer[] { result1, result2 }, target.Observers.ToList());
        }
        public void SerializeAndDeserialize_TeamWithMembersAndObservers_CopyOfTheTeam()
        {
            // Arrange
            var team = new ScrumTeam("test");

            team.SetScrumMaster("master");
            team.Join("member", false);
            team.Join("observer", true);
            team.Join("Bob", true);
            team.Join("Alice", false);

            // Act
            // Verify
            VerifySerialization(team);
        }
Beispiel #10
0
        public void Disconnect_ObserverNorMemberWithTheNameDoNotExist_ObserversAndMembersAreUnchanged()
        {
            // Arrange
            var name     = "test";
            var target   = new ScrumTeam("test team");
            var observer = target.Join("observer", true);
            var member   = target.Join("member", false);

            // Act
            target.Disconnect(name);

            // Verify
            CollectionAssert.AreEquivalent(new Observer[] { observer }, target.Observers.ToList());
            CollectionAssert.AreEquivalent(new Observer[] { member }, target.Members.ToList());
        }
Beispiel #11
0
        public void EstimationParticipants_MemberEstimated_MemberEstimatedButNotScrumMaster()
        {
            // Arrange
            var target = new ScrumTeam("test team");
            var master = target.SetScrumMaster("master");
            var member = target.Join("member", false);

            master.StartEstimation();

            // Act
            var result = target.EstimationParticipants;

            // Verify
            Assert.IsNotNull(result);
            Assert.AreEqual <int>(2, result.Count());

            var masterParticipant = result.First(p => p.MemberName == master.Name);

            Assert.IsNotNull(masterParticipant);
            Assert.IsFalse(masterParticipant.Estimated);

            var memberParticipant = result.First(p => p.MemberName == member.Name);

            Assert.IsNotNull(memberParticipant);
            Assert.IsFalse(memberParticipant.Estimated);
        }
Beispiel #12
0
        public void DisconnectInactiveObservers_EstimationStartedActiveScrumMasterInactiveMember_ScrumMasterGetsEstimationResult()
        {
            // Arrange
            var dateTimeProvider = new DateTimeProviderMock();

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

            var target = new ScrumTeam("test team", dateTimeProvider);
            var master = target.SetScrumMaster("master");
            var member = (Member)target.Join("member", false);

            master.StartEstimation();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 30));
            master.Estimation = new Estimation();
            master.UpdateActivity();

            dateTimeProvider.SetUtcNow(new DateTime(2012, 1, 1, 3, 2, 55));
            TestHelper.ClearMessages(master);

            // Act
            target.DisconnectInactiveObservers(TimeSpan.FromSeconds(30.0));

            // Verify
            Assert.AreEqual <TeamState>(TeamState.EstimationFinished, target.State);
            Assert.IsNotNull(target.EstimationResult);

            Assert.IsTrue(master.HasMessage);
            master.PopMessage();
            Assert.IsTrue(master.HasMessage);
            var message = master.PopMessage();

            Assert.AreEqual <MessageType>(MessageType.EstimationEnded, message.MessageType);
        }
Beispiel #13
0
        public void Join_AsMemberWhenObserverExists_ObserverMessageReceived()
        {
            // Arrange
            var       target    = new ScrumTeam("test team");
            var       master    = target.SetScrumMaster("master");
            var       observer  = target.Join("observer", true);
            EventArgs eventArgs = null;

            observer.MessageReceived += new EventHandler((s, e) => eventArgs = e);

            // Act
            var result = target.Join("member", false);

            // Verify
            Assert.IsNotNull(eventArgs);
        }
        public void Estimation_SetOnAllMembers_EstimationResultIsGeneratedForMember()
        {
            // Arrange
            var team   = new ScrumTeam("test team");
            var master = team.SetScrumMaster("master");
            var member = (Member)team.Join("member", false);

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

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

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

            Assert.IsInstanceOfType(message, typeof(EstimationResultMessage));
            var estimationResultMessage = (EstimationResultMessage)message;

            Assert.AreEqual <EstimationResult>(team.EstimationResult, estimationResultMessage.EstimationResult);
        }
        public void SerializeAndDeserialize_EstimationIsCancelled_CopyOfTheTeam()
        {
            // Arrange
            var team   = new ScrumTeam("test");
            var master = team.SetScrumMaster("master");

            team.Join("member", false);
            team.Join("observer", true);
            master.StartEstimation();
            master.Estimation = team.AvailableEstimations.Single(e => e.Value == 0);
            master.CancelEstimation();

            // Act
            // Verify
            VerifySerialization(team);
        }
Beispiel #16
0
        public void Estimation_SetOnAllMembers_EstimationResultIsGeneratedForScrumTeam()
        {
            // Arrange
            var team   = new ScrumTeam("test team");
            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();
            var memberEstimation = new Estimation();

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

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

            Assert.IsInstanceOfType(message, typeof(EstimationResultMessage));
            var estimationResultMessage = (EstimationResultMessage)message;

            Assert.AreEqual <EstimationResult>(team.EstimationResult, estimationResultMessage.EstimationResult);
        }
Beispiel #17
0
        public void Estimation_SetOnAllMembers_EstimationResultIsGenerated()
        {
            // Arrange
            var team   = new ScrumTeam("test team");
            var master = team.SetScrumMaster("master");
            var member = (Member)team.Join("member", false);

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

            // 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());
        }
Beispiel #18
0
        public void Estimation_SetOnAllMembers_ScrumTeamGetEstimationEndedMessage()
        {
            // Arrange
            var team   = new ScrumTeam("test team");
            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();
            var memberEstimation = new Estimation();

            // 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);
        }
Beispiel #19
0
        public void Disconnect_EstimationStarted_OnlyScrumMasterIsInEstimationResult()
        {
            // Arrange
            var target = new ScrumTeam("test team");
            var master = target.SetScrumMaster("master");
            var member = (Member)target.Join("member", false);

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

            // Act
            target.Disconnect(member.Name);
            master.Estimation = masterEstimation;

            // Verify
            Assert.AreEqual <TeamState>(TeamState.EstimationFinished, target.State);
            Assert.IsNotNull(target.EstimationResult);
            var expectedResult = new KeyValuePair <Member, Estimation>[]
            {
                new KeyValuePair <Member, Estimation>(master, masterEstimation),
                new KeyValuePair <Member, Estimation>(member, null)
            };

            CollectionAssert.AreEquivalent(expectedResult, target.EstimationResult.ToList());
        }
Beispiel #20
0
        public void FindMemberOrObserver_MemberNorObserverExists_ReturnsNull()
        {
            // Arrange
            var name   = "test";
            var target = new ScrumTeam("test team");

            target.Join("observer1", true);
            target.Join("observer2", true);
            target.Join("member1", false);
            target.Join("member2", false);

            // Act
            var result = target.FindMemberOrObserver(name);

            // Verify
            Assert.IsNull(result);
        }
Beispiel #21
0
        public void Join_AsMemberWhenObserverExists_ObserverGetMemberJoinedMessage()
        {
            // Arrange
            var target   = new ScrumTeam("test team");
            var master   = target.SetScrumMaster("master");
            var observer = target.Join("observer", true);

            // Act
            var result = target.Join("member", false);

            // Verify
            Assert.IsTrue(observer.HasMessage);
            var message = observer.PopMessage();

            Assert.AreEqual <MessageType>(MessageType.MemberJoined, message.MessageType);
            Assert.IsFalse(observer.HasMessage);
        }
Beispiel #22
0
        public void FindMemberOrObserver_MemberExists_ReturnsMember()
        {
            // Arrange
            var name   = "member2";
            var target = new ScrumTeam("test team");

            target.Join("observer1", true);
            target.Join("observer2", true);
            target.Join("member1", false);
            target.Join("member2", false);

            // Act
            var result = target.FindMemberOrObserver(name);

            // Verify
            Assert.IsNotNull(result);
            Assert.AreEqual <string>(name, result.Name);
        }
        public void SerializeAndDeserialize_EstimationEnded_CopyOfTheTeam()
        {
            // Arrange
            var team   = new ScrumTeam("test");
            var master = team.SetScrumMaster("master");
            var member = (Member)team.Join("member", false);

            team.Join("observer", true);
            master.StartEstimation();
            team.Join("Bob", true);
            team.Join("Alice", false);
            member.Estimation = team.AvailableEstimations.Single(e => e.Value == 0.5);
            master.Estimation = team.AvailableEstimations.Single(e => e.Value.HasValue && double.IsPositiveInfinity(e.Value.Value));

            // Act
            // Verify
            VerifySerialization(team);
        }
Beispiel #24
0
        public void Join_NameIsEmpty_ArgumentNullEsception()
        {
            // Arrange
            var name   = string.Empty;
            var target = new ScrumTeam("test team");

            // Act
            var result = target.Join(name, false);
        }
Beispiel #25
0
        public void Join_AsMemberWhenObserverExists_ObserverGetMessageWithMember()
        {
            // Arrange
            var target   = new ScrumTeam("test team");
            var master   = target.SetScrumMaster("master");
            var observer = target.Join("observer", true);

            // Act
            var result = target.Join("member", false);

            // Verify
            var message = observer.PopMessage();

            Assert.IsInstanceOfType(message, typeof(MemberMessage));
            var memberMessage = (MemberMessage)message;

            Assert.AreEqual <Observer>(result, memberMessage.Member);
        }
        private static ScrumTeam CreateScrumTeam(string name = "The team")
        {
            var team = new ScrumTeam(name);

            team.SetScrumMaster("master");
            team.Join("member", false);
            team.ScrumMaster.StartEstimation();
            team.ScrumMaster.Estimation = team.AvailableEstimations.First(e => e.Value == 5);
            return(team);
        }
        public void Constructor_DuplicateMember_InvalidOperationException()
        {
            // Arrange
            var team   = new ScrumTeam("test team");
            var master = team.SetScrumMaster("master");
            var member = (Member)team.Join("member", false);

            // Act
            var result = new EstimationResult(new Member[] { master, member, master });
        }
Beispiel #28
0
        public void SetScrumMaster_ObserverWithSpecifiedNameExists_ArgumentException()
        {
            // Arrange
            var name   = "test";
            var target = new ScrumTeam("test team");

            target.Join("test", true);

            // Act
            var result = target.SetScrumMaster(name);
        }
        public void IndexerGet_MemberNotInResult_KeyNotFoundException()
        {
            // Arrange
            var team   = new ScrumTeam("test team");
            var master = team.SetScrumMaster("master");
            var member = (Member)team.Join("member", false);
            var target = new EstimationResult(new Member[] { master });

            // Act
            var estimation = target[member];
        }
Beispiel #30
0
        public void Disconnect_AsMemberWhenObserverExists_MemberGetsEmptyMessage()
        {
            // Arrange
            var target   = new ScrumTeam("test team");
            var master   = target.SetScrumMaster("master");
            var member   = target.Join("member", false);
            var observer = target.Join("observer", true);

            TestHelper.ClearMessages(member);

            // Act
            target.Disconnect(member.Name);

            // Verify
            Assert.IsTrue(member.HasMessage);
            var message = member.PopMessage();

            Assert.AreEqual <MessageType>(MessageType.Empty, message.MessageType);
            Assert.IsFalse(member.HasMessage);
        }