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); }
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); }
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); }
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); }
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); }
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); }
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); }
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()); }
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); }
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); }
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); }
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); }
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()); }
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); }
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()); }
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); }
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); }
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); }
public void Join_NameIsEmpty_ArgumentNullEsception() { // Arrange var name = string.Empty; var target = new ScrumTeam("test team"); // Act var result = target.Join(name, false); }
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 }); }
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]; }
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); }