Example #1
0
        public async Task ProcessMessages_MemberJoinedWithObserver_1Observer()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();

            scrumTeam.Observers = null;
            scrumTeam.State     = TeamState.EstimationFinished;
            var target = CreateController(propertyChangedCounter);
            await target.InitializeTeam(CreateTeamResult(scrumTeam), PlanningPokerData.MemberName);

            var message = new MemberMessage
            {
                Id     = 1,
                Type   = MessageType.MemberJoined,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.ObserverType,
                    Name = "New observer"
                }
            };

            ProcessMessage(target, message);

            Assert.AreEqual(1, propertyChangedCounter.Count);
            Assert.AreEqual(1, target.LastMessageId);
            var expectedMembers = new string[] { PlanningPokerData.MemberName };

            CollectionAssert.AreEqual(expectedMembers, target.Members.Select(m => m.Name).ToList());
            expectedMembers = new string[] { "New observer" };
            CollectionAssert.AreEqual(expectedMembers, target.Observers.Select(m => m.Name).ToList());
            PlanningPokerControllerTest.AssertNoMemberHasEstimated(target);
        }
Example #2
0
        public async Task ProcessMessages_MemberJoinedWithMember_2Members()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();
            var target    = CreateController(propertyChangedCounter);
            await target.InitializeTeam(scrumTeam, PlanningPokerData.ScrumMasterName);

            var message = new MemberMessage
            {
                Id     = 0,
                Type   = MessageType.MemberJoined,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.MemberType,
                    Name = "New member"
                }
            };

            ProcessMessage(target, message);

            Assert.AreEqual(1, propertyChangedCounter.Count);
            Assert.AreEqual(0, target.LastMessageId);
            var expectedMembers = new string[] { "New member", PlanningPokerData.MemberName };

            CollectionAssert.AreEqual(expectedMembers, target.Members.ToList());
            expectedMembers = new string[] { PlanningPokerData.ObserverName };
            CollectionAssert.AreEqual(expectedMembers, target.Observers.ToList());
        }
Example #3
0
        public async Task ProcessMessages_EstimationCanceled_StateIsEstimationCanceled()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();

            scrumTeam.State = TeamState.EstimationInProgress;
            var target = CreateController(propertyChangedCounter);
            await target.InitializeTeam(CreateTeamResult(scrumTeam), PlanningPokerData.ScrumMasterName);

            var message = new Message
            {
                Id   = 4,
                Type = MessageType.EstimationCanceled
            };

            ProcessMessage(target, message);

            Assert.AreEqual(1, propertyChangedCounter.Count);
            Assert.AreEqual(4, target.LastMessageId);
            Assert.AreEqual(TeamState.EstimationCanceled, target.ScrumTeam.State);
            Assert.IsFalse(target.CanSelectEstimation);
            Assert.IsTrue(target.CanStartEstimation);
            Assert.IsFalse(target.CanCancelEstimation);
            PlanningPokerControllerTest.AssertNoMemberHasEstimated(target);
        }
Example #4
0
        public async Task ProcessMessages_MemberEstimatedWithScrumMaster_1Estimation()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();
            var target    = CreateController(propertyChangedCounter);
            await target.InitializeTeam(scrumTeam, PlanningPokerData.ObserverName);

            var message = new MemberMessage
            {
                Id     = 4,
                Type   = MessageType.MemberEstimated,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.ScrumMasterType,
                    Name = PlanningPokerData.ScrumMasterName
                }
            };

            StartEstimation(target);
            ProcessMessage(target, message);

            Assert.AreEqual(2, propertyChangedCounter.Count);
            Assert.AreEqual(4, target.LastMessageId);
            Assert.IsFalse(target.CanSelectEstimation);
            Assert.IsFalse(target.CanStartEstimation);
            Assert.IsFalse(target.CanCancelEstimation);

            Assert.AreEqual(1, target.Estimations.Count());
            var estimation = target.Estimations.First();

            Assert.AreEqual(PlanningPokerData.ScrumMasterName, estimation.MemberName);
            Assert.IsFalse(estimation.HasEstimation);
        }
Example #5
0
        public async Task ProcessMessages_MemberDisconnectedWithNotExistingName_NoChanges()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();

            scrumTeam.State = TeamState.EstimationCanceled;
            var target = CreateController(propertyChangedCounter);
            await target.InitializeTeam(scrumTeam, PlanningPokerData.MemberName);

            var message = new MemberMessage
            {
                Id     = 0,
                Type   = MessageType.MemberDisconnected,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.MemberType,
                    Name = "Disconnect"
                }
            };

            ProcessMessage(target, message);

            Assert.AreEqual(1, propertyChangedCounter.Count);
            Assert.AreEqual(0, target.LastMessageId);
            Assert.AreEqual(PlanningPokerData.ScrumMasterName, target.ScrumMaster);
            var expectedMembers = new string[] { PlanningPokerData.MemberName };

            CollectionAssert.AreEqual(expectedMembers, target.Members.ToList());
            expectedMembers = new string[] { PlanningPokerData.ObserverName };
            CollectionAssert.AreEqual(expectedMembers, target.Observers.ToList());
        }
Example #6
0
        public async Task ProcessMessages_MemberDisconnectedWithObserver_0Observers()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();
            var target    = CreateController(propertyChangedCounter);
            await target.InitializeTeam(CreateTeamResult(scrumTeam), PlanningPokerData.MemberName);

            var message = new MemberMessage
            {
                Id     = 1,
                Type   = MessageType.MemberDisconnected,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.ObserverType,
                    Name = PlanningPokerData.ObserverName
                }
            };

            ProcessMessage(target, message);

            Assert.AreEqual(1, propertyChangedCounter.Count);
            Assert.AreEqual(1, target.LastMessageId);
            Assert.AreEqual(PlanningPokerData.ScrumMasterName, target.ScrumMaster.Name);
            var expectedMembers = new string[] { PlanningPokerData.MemberName };

            CollectionAssert.AreEqual(expectedMembers, target.Members.Select(m => m.Name).ToList());
            expectedMembers = Array.Empty <string>();
            CollectionAssert.AreEqual(expectedMembers, target.Observers.Select(m => m.Name).ToList());
            PlanningPokerControllerTest.AssertNoMemberHasEstimated(target);
        }
Example #7
0
        public async Task CreateTeam_TeamNameAndScrumMasterName_ReturnTrue()
        {
            var scrumTeam = PlanningPokerData.GetInitialScrumTeam();
            var target    = CreateController(scrumTeam: scrumTeam);

            var result = await target.CreateTeam(PlanningPokerData.TeamName, PlanningPokerData.ScrumMasterName);

            Assert.IsTrue(result);
        }
Example #8
0
        public async Task JoinTeam_MemberName_ReturnsTrue(string memberName, bool asObserver)
        {
            var scrumTeam = PlanningPokerData.GetScrumTeam();
            var target    = CreateController(scrumTeam: scrumTeam);

            var result = await target.JoinTeam(PlanningPokerData.TeamName, memberName, asObserver);

            Assert.IsTrue(result);
        }
Example #9
0
        public async Task ProcessMessages_Null_ArgumentNullException()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();
            var target    = CreateController(propertyChangedCounter);
            await target.InitializeTeam(scrumTeam, PlanningPokerData.ScrumMasterName);

            Assert.ThrowsException <ArgumentNullException>(() => target.ProcessMessages(null));
        }
Example #10
0
        public async Task TryReconnectTeam_ServiceThrowsException_ReturnsFalse()
        {
            var memberCredentials = PlanningPokerData.GetMemberCredentials();
            var target            = CreateController(memberExistsError: true, errorMessage: ErrorMessage, memberCredentials: memberCredentials);

            var result = await target.TryReconnectTeam(PlanningPokerData.TeamName, PlanningPokerData.MemberName);

            Assert.IsFalse(result);
        }
Example #11
0
        public async Task ReconnectTeam_MemberName_ReturnsTrue(string memberName, bool asObserver)
        {
            var reconnectTeamResult = PlanningPokerData.GetReconnectTeamResult();
            var target = CreateController(memberExistsError: true, reconnectTeamResult: reconnectTeamResult);

            var result = await target.JoinTeam(PlanningPokerData.TeamName, memberName, asObserver);

            Assert.IsTrue(result);
        }
        public async Task JoinTeam_ServiceReturnsTeam_NavigatesToPlanningPoker()
        {
            var teamResult        = PlanningPokerData.GetTeamResult();
            var navigationManager = new Mock <INavigationManager>();
            var target            = CreateController(navigationManager: navigationManager.Object, teamResult: teamResult);

            await target.JoinTeam(PlanningPokerData.TeamName, PlanningPokerData.ObserverName, true);

            navigationManager.Verify(o => o.NavigateTo("PlanningPoker/Test%20team/Test%20observer"));
        }
Example #13
0
        public async Task CreateTeam_ServiceReturnsTeam_InitializePlanningPokerController()
        {
            var scrumTeam = PlanningPokerData.GetInitialScrumTeam();
            var planningPokerInitializer = new Mock <IPlanningPokerInitializer>();
            var target = CreateController(planningPokerInitializer: planningPokerInitializer.Object, scrumTeam: scrumTeam);

            await target.CreateTeam(PlanningPokerData.TeamName, PlanningPokerData.ScrumMasterName);

            planningPokerInitializer.Verify(o => o.InitializeTeam(scrumTeam, PlanningPokerData.ScrumMasterName));
        }
Example #14
0
        public async Task JoinTeam_ServiceReturnsTeam_NavigatesToPlanningPoker()
        {
            var scrumTeam = PlanningPokerData.GetScrumTeam();
            var uriHelper = new Mock <IUriHelper>();
            var target    = CreateController(uriHelper: uriHelper.Object, scrumTeam: scrumTeam);

            await target.JoinTeam(PlanningPokerData.TeamName, PlanningPokerData.ObserverName, true);

            uriHelper.Verify(o => o.NavigateTo("PlanningPoker/Test%20team/Test%20observer"));
        }
        public async Task CreateTeam_ServiceReturnsTeam_NavigatesToPlanningPoker()
        {
            var scrumTeam         = PlanningPokerData.GetInitialScrumTeam();
            var navigationManager = new Mock <INavigationManager>();
            var target            = CreateController(navigationManager: navigationManager.Object, scrumTeam: scrumTeam);

            await target.CreateTeam(PlanningPokerData.TeamName, PlanningPokerData.ScrumMasterName);

            navigationManager.Verify(o => o.NavigateTo("PlanningPoker/Test%20team/Test%20Scrum%20Master"));
        }
Example #16
0
        public async Task TryReconnectTeam_ReconnectTeamIsSuccessful_ReturnsTrue()
        {
            var reconnectTeamResult = PlanningPokerData.GetReconnectTeamResult();
            var memberCredentials   = PlanningPokerData.GetMemberCredentials();
            var target = CreateController(memberExistsError: true, reconnectTeamResult: reconnectTeamResult, memberCredentials: memberCredentials);

            var result = await target.TryReconnectTeam(PlanningPokerData.TeamName, PlanningPokerData.MemberName);

            Assert.IsTrue(result);
        }
Example #17
0
        public async Task JoinTeam_ServiceReturnsTeam_InitializePlanningPokerController()
        {
            var scrumTeam = PlanningPokerData.GetScrumTeam();
            var planningPokerInitializer = new Mock <IPlanningPokerInitializer>();
            var target = CreateController(planningPokerInitializer: planningPokerInitializer.Object, scrumTeam: scrumTeam);

            var result = await target.JoinTeam(PlanningPokerData.TeamName, PlanningPokerData.MemberName, false);

            planningPokerInitializer.Verify(o => o.InitializeTeam(scrumTeam, PlanningPokerData.MemberName));
        }
Example #18
0
        public async Task ReconnectTeam_ServiceReturnsTeam_NavigatesToPlanningPoker()
        {
            var reconnectTeamResult = PlanningPokerData.GetReconnectTeamResult();
            var uriHelper           = new Mock <IUriHelper>();
            var target = CreateController(memberExistsError: true, uriHelper: uriHelper.Object, reconnectTeamResult: reconnectTeamResult);

            await target.JoinTeam(PlanningPokerData.TeamName, PlanningPokerData.ObserverName, true);

            uriHelper.Verify(o => o.NavigateTo("PlanningPoker/Test%20team/Test%20observer"));
        }
Example #19
0
        public async Task ReconnectTeam_ServiceReturnsTeam_InitializePlanningPokerController()
        {
            var reconnectTeamResult      = PlanningPokerData.GetReconnectTeamResult();
            var planningPokerInitializer = new Mock <IPlanningPokerInitializer>();
            var target = CreateController(memberExistsError: true, planningPokerInitializer: planningPokerInitializer.Object, reconnectTeamResult: reconnectTeamResult);

            var result = await target.JoinTeam(PlanningPokerData.TeamName, PlanningPokerData.MemberName, false);

            planningPokerInitializer.Verify(o => o.InitializeTeam(reconnectTeamResult, PlanningPokerData.MemberName));
        }
Example #20
0
        public async Task ProcessMessages_EmptyCollection_LastMessageIdIsNotUpdated()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();
            var target    = CreateController(propertyChangedCounter);
            await target.InitializeTeam(scrumTeam, PlanningPokerData.ScrumMasterName);

            target.ProcessMessages(Enumerable.Empty <Message>());

            Assert.AreEqual(0, propertyChangedCounter.Count);
            Assert.AreEqual(-1, target.LastMessageId);
        }
Example #21
0
        public async Task ProcessMessages_2xMemberEstimated_2Estimations()
        {
            var propertyChangedCounter = new PropertyChangedCounter();
            var scrumTeam = PlanningPokerData.GetScrumTeam();
            var target    = CreateController(propertyChangedCounter);
            await target.InitializeTeam(CreateTeamResult(scrumTeam), PlanningPokerData.MemberName);

            var message1 = new MemberMessage
            {
                Id     = 5,
                Type   = MessageType.MemberEstimated,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.ScrumMasterType,
                    Name = PlanningPokerData.ScrumMasterName
                }
            };
            var message2 = new MemberMessage
            {
                Id     = 6,
                Type   = MessageType.MemberEstimated,
                Member = new TeamMember
                {
                    Type = PlanningPokerData.MemberType,
                    Name = PlanningPokerData.MemberName
                }
            };

            StartEstimation(target);
            target.ProcessMessages(new Message[] { message2, message1 });

            Assert.AreEqual(3, propertyChangedCounter.Count);
            Assert.AreEqual(6, target.LastMessageId);
            Assert.IsTrue(target.CanSelectEstimation);
            Assert.IsFalse(target.CanStartEstimation);
            Assert.IsFalse(target.CanCancelEstimation);
            PlanningPokerControllerTest.AssertNoObserverHasEstimated(target);

            var estimations = target.Estimations.ToList();

            Assert.AreEqual(2, estimations.Count);
            var estimation = estimations[0];

            Assert.AreEqual(PlanningPokerData.ScrumMasterName, estimation.MemberName);
            Assert.IsFalse(estimation.HasEstimation);
            estimation = estimations[1];
            Assert.AreEqual(PlanningPokerData.MemberName, estimation.MemberName);
            Assert.IsFalse(estimation.HasEstimation);

            Assert.IsTrue(target.ScrumMaster.HasEstimated);
            PlanningPokerControllerTest.AssertMemberHasEstimated(target, PlanningPokerData.MemberName, true);
        }
Example #22
0
        public async Task TryReconnectTeam_TeamNameAndMemberName_LoadsMemberCredentialsFromStore()
        {
            var reconnectTeamResult    = PlanningPokerData.GetReconnectTeamResult();
            var memberCredentials      = PlanningPokerData.GetMemberCredentials();
            var memberCredentialsStore = new Mock <IMemberCredentialsStore>();

            memberCredentialsStore.Setup(o => o.GetCredentialsAsync()).ReturnsAsync(memberCredentials);
            var target = CreateController(memberCredentialsStore: memberCredentialsStore.Object, memberExistsError: true, reconnectTeamResult: reconnectTeamResult);

            await target.TryReconnectTeam(PlanningPokerData.TeamName, PlanningPokerData.MemberName);

            memberCredentialsStore.Verify(o => o.GetCredentialsAsync());
        }
Example #23
0
        public async Task CreateTeam_TeamName_CreateTeamOnService()
        {
            var scrumTeam            = PlanningPokerData.GetInitialScrumTeam();
            var planningPokerService = new Mock <IPlanningPokerClient>();

            planningPokerService.Setup(o => o.CreateTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(scrumTeam);
            var target = CreateController(planningPokerService: planningPokerService.Object);

            await target.CreateTeam(PlanningPokerData.TeamName, PlanningPokerData.ScrumMasterName);

            planningPokerService.Verify(o => o.CreateTeam(PlanningPokerData.TeamName, PlanningPokerData.ScrumMasterName, It.IsAny <CancellationToken>()));
        }
Example #24
0
        public async Task TryReconnectTeam_ServiceThrowsException_DoesNotNavigateToPlanningPoker()
        {
            var memberCredentials = PlanningPokerData.GetMemberCredentials();
            var uriHelper         = new Mock <IUriHelper>();
            var target            = CreateController(
                uriHelper: uriHelper.Object,
                memberExistsError: true,
                errorMessage: ErrorMessage,
                memberCredentials: memberCredentials);

            await target.TryReconnectTeam(PlanningPokerData.TeamName, PlanningPokerData.MemberName);

            uriHelper.Verify(o => o.NavigateTo(It.IsAny <string>()), Times.Never());
        }
Example #25
0
        public async Task TryReconnectTeam_ServiceThrowsException_DoesNotInitializePlanningPokerController()
        {
            var memberCredentials        = PlanningPokerData.GetMemberCredentials();
            var planningPokerInitializer = new Mock <IPlanningPokerInitializer>();
            var target = CreateController(
                planningPokerInitializer: planningPokerInitializer.Object,
                memberExistsError: true,
                errorMessage: ErrorMessage,
                memberCredentials: memberCredentials);

            await target.TryReconnectTeam(PlanningPokerData.TeamName, PlanningPokerData.MemberName);

            planningPokerInitializer.Verify(o => o.InitializeTeam(It.IsAny <ReconnectTeamResult>(), It.IsAny <string>()), Times.Never());
        }
Example #26
0
        public async Task TryReconnectTeam_CredentialsAreStored_ReconnectTeamOnService(string teamName, string memberName)
        {
            var reconnectTeamResult  = PlanningPokerData.GetReconnectTeamResult();
            var planningPokerService = new Mock <IPlanningPokerClient>();

            planningPokerService.Setup(o => o.ReconnectTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(reconnectTeamResult);
            var memberCredentials = PlanningPokerData.GetMemberCredentials();
            var target            = CreateController(planningPokerService: planningPokerService.Object, memberCredentials: memberCredentials);

            await target.TryReconnectTeam(teamName, memberName);

            planningPokerService.Verify(o => o.ReconnectTeam(teamName, memberName, It.IsAny <CancellationToken>()));
        }
Example #27
0
        public async Task JoinTeam_MemberName_JoinTeamOnService(string memberName, bool asObserver)
        {
            var scrumTeam            = PlanningPokerData.GetScrumTeam();
            var planningPokerService = new Mock <IPlanningPokerClient>();

            planningPokerService.Setup(o => o.JoinTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(scrumTeam);
            var target = CreateController(planningPokerService: planningPokerService.Object);

            await target.JoinTeam(PlanningPokerData.TeamName, memberName, asObserver);

            planningPokerService.Verify(o => o.JoinTeam(PlanningPokerData.TeamName, memberName, asObserver, It.IsAny <CancellationToken>()));
            planningPokerService.Verify(o => o.ReconnectTeam(PlanningPokerData.TeamName, memberName, It.IsAny <CancellationToken>()), Times.Never());
        }
Example #28
0
        public async Task TryReconnectTeam_ServiceThrowsException_DoesNotShowUserMessage()
        {
            var memberCredentials = PlanningPokerData.GetMemberCredentials();
            var messageBoxService = new Mock <IMessageBoxService>();
            var target            = CreateController(
                messageBoxService: messageBoxService.Object,
                memberExistsError: true,
                errorMessage: ErrorMessage,
                memberCredentials: memberCredentials);

            await target.TryReconnectTeam(PlanningPokerData.TeamName, PlanningPokerData.MemberName);

            messageBoxService.Verify(o => o.ShowMessage(It.IsAny <string>(), It.IsAny <string>()), Times.Never());
            messageBoxService.Verify(o => o.ShowMessage(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>()), Times.Never());
        }
Example #29
0
        public async Task TryReconnectTeam_ReconnectTeamIsSuccessful_NavigatesToPlanningPoker()
        {
            var reconnectTeamResult = PlanningPokerData.GetReconnectTeamResult();
            var memberCredentials   = PlanningPokerData.GetMemberCredentials();
            var uriHelper           = new Mock <IUriHelper>();
            var target = CreateController(
                uriHelper: uriHelper.Object,
                memberExistsError: true,
                reconnectTeamResult: reconnectTeamResult,
                memberCredentials: memberCredentials);

            await target.TryReconnectTeam(PlanningPokerData.TeamName, PlanningPokerData.MemberName);

            uriHelper.Verify(o => o.NavigateTo("PlanningPoker/Test%20team/Test%20member"));
        }
Example #30
0
        public async Task TryReconnectTeam_ReconnectTeamIsSuccessful_InitializePlanningPokerController()
        {
            var reconnectTeamResult      = PlanningPokerData.GetReconnectTeamResult();
            var memberCredentials        = PlanningPokerData.GetMemberCredentials();
            var planningPokerInitializer = new Mock <IPlanningPokerInitializer>();
            var target = CreateController(
                planningPokerInitializer: planningPokerInitializer.Object,
                memberExistsError: true,
                reconnectTeamResult: reconnectTeamResult,
                memberCredentials: memberCredentials);

            await target.TryReconnectTeam(PlanningPokerData.TeamName, PlanningPokerData.MemberName);

            planningPokerInitializer.Verify(o => o.InitializeTeam(reconnectTeamResult, PlanningPokerData.MemberName));
        }