public async Task Start_NotInitAndMasterActivityFromServiceBus_MessageIgnored() { // Arrange var planningPoker = new Mock <IAzurePlanningPoker>(MockBehavior.Strict); var serviceBus = new Mock <IServiceBus>(MockBehavior.Strict); var target = CreatePlanningPokerAzureNode(planningPoker.Object, serviceBus.Object, CreateConfigutartion()); var message = new ScrumTeamMemberMessage(TeamName, MessageType.MemberActivity) { MemberName = ScrumMasterName, MemberType = "ScrumMaster" }; var nodeMessage = new NodeMessage(NodeMessageType.ScrumTeamMessage) { Data = message }; var sendMessages = SetupServiceBus(serviceBus, target.NodeId, new string[] { TeamName }, nodeMessage); SetupPlanningPoker(planningPoker, null, true); planningPoker.Setup(p => p.DateTimeProvider).Returns(new DateTimeProviderMock()).Verifiable(); // Act await target.Start(); sendMessages(); await target.Stop(); // Verify planningPoker.Verify(p => p.GetScrumTeam(It.IsAny <string>()), Times.Never()); planningPoker.Verify(); serviceBus.Verify(); }
public async Task Start_MasterDisconnectedFromServiceBus_MasterDisconnectedFromTeam() { // Arrange var planningPoker = new Mock <IAzurePlanningPoker>(MockBehavior.Strict); var serviceBus = new Mock <IServiceBus>(MockBehavior.Strict); var target = CreatePlanningPokerAzureNode(planningPoker.Object, serviceBus.Object, CreateConfigutartion()); var message = new ScrumTeamMemberMessage(TeamName, MessageType.MemberDisconnected) { MemberName = ScrumMasterName, MemberType = "ScrumMaster" }; var nodeMessage = new NodeMessage(NodeMessageType.ScrumTeamMessage) { Data = message }; var sendMessages = SetupServiceBus(serviceBus, target.NodeId, nodeMessage); var team = CreateBasicTeam(); var teamLock = SetupPlanningPoker(planningPoker, team); // Act await target.Start(); sendMessages(); await target.Stop(); // Verify planningPoker.Verify(); serviceBus.Verify(); teamLock.Verify(); Assert.IsNull(team.ScrumMaster); }
public void Start_MemberJoined_MessageIsSentToServiceBus() { // Arrange var planningPoker = new Mock <IAzurePlanningPoker>(MockBehavior.Strict); var serviceBus = new Mock <IServiceBus>(MockBehavior.Strict); var target = new PlanningPokerAzureNode(planningPoker.Object, serviceBus.Object, CreateConfigutartion()); planningPoker.Setup(p => p.SetTeamsInitializingList(It.IsAny <IEnumerable <string> >())); planningPoker.Setup(p => p.EndInitialization()); var message = new ScrumTeamMemberMessage(TeamName, MessageType.MemberJoined) { MemberName = MemberName }; var startPlanningPokerMsg = SetupPlanningPokerMsg(planningPoker, message); var sendServiceBusMsg = SetupServiceBus(serviceBus, target.NodeId, null); NodeMessage nodeMessage = null; serviceBus.Setup(b => b.SendMessage(It.Is <NodeMessage>(m => m.MessageType == NodeMessageType.ScrumTeamMessage))).Callback <NodeMessage>(m => nodeMessage = m).Verifiable(); // Act target.Start(); sendServiceBusMsg(); startPlanningPokerMsg(); target.Stop(); // Verify planningPoker.Verify(); serviceBus.Verify(); Assert.IsNotNull(nodeMessage); Assert.AreEqual <NodeMessageType>(NodeMessageType.ScrumTeamMessage, nodeMessage.MessageType); Assert.AreEqual <string>(target.NodeId, nodeMessage.SenderNodeId); Assert.AreEqual(message, nodeMessage.Data); }
public async Task Start_MasterActivityFromServiceBus_MasterUpdatedActivityInTeam() { // Arrange var planningPoker = new Mock <IAzurePlanningPoker>(MockBehavior.Strict); var serviceBus = new Mock <IServiceBus>(MockBehavior.Strict); var target = CreatePlanningPokerAzureNode(planningPoker.Object, serviceBus.Object, CreateConfigutartion()); var message = new ScrumTeamMemberMessage(TeamName, MessageType.MemberActivity) { MemberName = ScrumMasterName, MemberType = "ScrumMaster" }; var nodeMessage = new NodeMessage(NodeMessageType.ScrumTeamMessage) { Data = message }; var sendMessages = SetupServiceBus(serviceBus, target.NodeId, nodeMessage); var dateTimeProvider = new DateTimeProviderMock(); dateTimeProvider.SetUtcNow(new DateTime(2012, 9, 9, 23, 27, 33, DateTimeKind.Utc)); var team = new ScrumTeam(TeamName, dateTimeProvider); team.SetScrumMaster(ScrumMasterName); var teamLock = SetupPlanningPoker(planningPoker, team); dateTimeProvider.SetUtcNow(new DateTime(2012, 9, 9, 23, 28, 27, DateTimeKind.Utc)); // Act await target.Start(); sendMessages(); await target.Stop(); // Verify planningPoker.Verify(); serviceBus.Verify(); teamLock.Verify(); Assert.AreEqual <DateTime>(dateTimeProvider.UtcNow, team.ScrumMaster.LastActivity); }
public void ConvertToBrokeredMessageAndBack_ScrumTeamMemberMessage() { var scrumTeamMessage = new ScrumTeamMemberMessage(TeamName, MessageType.MemberJoined) { MemberType = "Observer", MemberName = "Test person", SessionId = Guid.NewGuid() }; var nodeMessage = new NodeMessage(NodeMessageType.ScrumTeamMessage) { SenderNodeId = SenderId, Data = scrumTeamMessage }; var result = ConvertToBrokeredMessageAndBack(nodeMessage); var resultData = (ScrumTeamMemberMessage)result.Data; Assert.AreEqual(MessageType.MemberJoined, resultData.MessageType); Assert.AreEqual(TeamName, resultData.TeamName); Assert.AreEqual(scrumTeamMessage.MemberType, resultData.MemberType); Assert.AreEqual(scrumTeamMessage.MemberName, resultData.MemberName); Assert.AreEqual(scrumTeamMessage.SessionId, resultData.SessionId); }
public async Task Start_ObserverJoinedFromServiceBus_ObserverJoinedTeam() { // Arrange var planningPoker = new Mock <IAzurePlanningPoker>(MockBehavior.Strict); var serviceBus = new Mock <IServiceBus>(MockBehavior.Strict); var target = CreatePlanningPokerAzureNode(planningPoker.Object, serviceBus.Object, CreateConfigutartion()); var message = new ScrumTeamMemberMessage(TeamName, MessageType.MemberJoined) { MemberName = ObserverName, MemberType = "Observer" }; var nodeMessage = new NodeMessage(NodeMessageType.ScrumTeamMessage) { Data = message }; var sendMessages = SetupServiceBus(serviceBus, target.NodeId, nodeMessage); var team = CreateBasicTeam(); var teamLock = SetupPlanningPoker(planningPoker, team); // Act await target.Start(); sendMessages(); await target.Stop(); // Verify planningPoker.Verify(); serviceBus.Verify(); teamLock.Verify(); var observer = team.FindMemberOrObserver(ObserverName); Assert.IsNotNull(observer); Assert.IsInstanceOfType(observer, typeof(Observer)); Assert.AreEqual <string>(ObserverName, observer.Name); }