Exemple #1
0
        private async Task <bool> ReconnectTeam(string teamName, string memberName, bool ignoreError, CancellationToken cancellationToken)
        {
            try
            {
                ReconnectTeamResult reconnectTeamResult = null;
                using (_busyIndicatorService.Show())
                {
                    reconnectTeamResult = await _planningPokerService.ReconnectTeam(teamName, memberName, cancellationToken);
                }

                if (reconnectTeamResult != null)
                {
                    await _planningPokerInitializer.InitializeTeam(reconnectTeamResult, memberName);

                    ControllerHelper.OpenPlanningPokerPage(_uriHelper, reconnectTeamResult.ScrumTeam, memberName);
                    return(true);
                }
            }
            catch (PlanningPokerException ex)
            {
                if (!ignoreError)
                {
                    var message = ControllerHelper.GetErrorMessage(ex);
                    await _messageBoxService.ShowMessage(message, Resources.MessagePanel_Error);
                }
            }

            return(false);
        }
        public void JsonSerialize_ReconnectTeamResult_Initial()
        {
            var scrumMaster = new TeamMember {
                Name = "master", Type = "ScrumMaster"
            };

            var scrumTeam = new ScrumTeam
            {
                Name        = "Test Team",
                State       = TeamState.Initial,
                ScrumMaster = scrumMaster,
                Members     = new List <TeamMember> {
                    scrumMaster
                },
                AvailableEstimations = new List <Estimation>
                {
                    new Estimation {
                        Value = null
                    },
                    new Estimation {
                        Value = 1
                    },
                    new Estimation {
                        Value = 2
                    }
                }
            };

            var reconnectTeamResult = new ReconnectTeamResult
            {
                ScrumTeam     = scrumTeam,
                LastMessageId = 0
            };

            var result = SerializeAndDeserialize(reconnectTeamResult);

            Assert.IsNotNull(result);
            Assert.AreEqual(reconnectTeamResult.LastMessageId, result.LastMessageId);
            Assert.IsNull(result.SelectedEstimation);

            var resultScrumTeam = result.ScrumTeam;

            Assert.AreEqual(scrumTeam.Name, resultScrumTeam.Name);
            Assert.AreEqual(scrumTeam.State, resultScrumTeam.State);
            Assert.AreEqual(scrumTeam.ScrumMaster.Name, resultScrumTeam.ScrumMaster.Name);
            Assert.AreEqual(scrumTeam.ScrumMaster.Type, resultScrumTeam.ScrumMaster.Type);
            Assert.AreEqual(scrumTeam.Members[0].Name, resultScrumTeam.Members[0].Name);
            Assert.AreEqual(scrumTeam.Members[0].Type, resultScrumTeam.Members[0].Type);
            Assert.AreEqual(scrumTeam.AvailableEstimations[0].Value, resultScrumTeam.AvailableEstimations[0].Value);
            Assert.AreEqual(scrumTeam.AvailableEstimations[1].Value, resultScrumTeam.AvailableEstimations[1].Value);
            Assert.AreEqual(scrumTeam.AvailableEstimations[2].Value, resultScrumTeam.AvailableEstimations[2].Value);
        }
Exemple #3
0
        /// <summary>
        /// Initialize <see cref="PlanningPokerController"/> object with Scrum Team data received from server.
        /// </summary>
        /// <param name="teamInfo">Scrum Team data received from server.</param>
        /// <param name="username">Name of user joining the Scrum Team.</param>
        /// <returns>Asynchronous operation.</returns>
        /// <remarks>This method overloads setup additional information after reconnecting to existing team.</remarks>
        public async Task InitializeTeam(ReconnectTeamResult teamInfo, string username)
        {
            if (teamInfo == null)
            {
                throw new ArgumentNullException(nameof(teamInfo));
            }

            if (string.IsNullOrEmpty(username))
            {
                throw new ArgumentNullException(nameof(username));
            }

            await InitializeTeam(teamInfo.ScrumTeam, username);

            LastMessageId       = teamInfo.LastMessageId;
            _selectedEstimation = teamInfo.SelectedEstimation;
        }
Exemple #4
0
        private static JoinTeamController CreateController(
            IPlanningPokerInitializer planningPokerInitializer = null,
            IPlanningPokerClient planningPokerService          = null,
            IMessageBoxService messageBoxService       = null,
            IBusyIndicatorService busyIndicatorService = null,
            IUriHelper uriHelper = null,
            IMemberCredentialsStore memberCredentialsStore = null,
            bool memberExistsError = false,
            ScrumTeam scrumTeam    = null,
            ReconnectTeamResult reconnectTeamResult = null,
            string errorMessage = null,
            MemberCredentials memberCredentials = null)
        {
            if (planningPokerInitializer == null)
            {
                var planningPokerInitializerMock = new Mock <IPlanningPokerInitializer>();
                planningPokerInitializer = planningPokerInitializerMock.Object;
            }

            if (planningPokerService == null)
            {
                var planningPokerServiceMock = new Mock <IPlanningPokerClient>();
                var joinSetup      = planningPokerServiceMock.Setup(o => o.JoinTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <CancellationToken>()));
                var reconnectSetup = planningPokerServiceMock.Setup(o => o.ReconnectTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()));
                if (memberExistsError)
                {
                    joinSetup.ThrowsAsync(new PlanningPokerException(ReconnectErrorMessage));
                    if (errorMessage == null)
                    {
                        reconnectSetup.ReturnsAsync(reconnectTeamResult);
                    }
                    else
                    {
                        reconnectSetup.ThrowsAsync(new PlanningPokerException(errorMessage));
                    }
                }
                else
                {
                    if (errorMessage == null)
                    {
                        joinSetup.ReturnsAsync(scrumTeam);
                    }
                    else
                    {
                        joinSetup.ThrowsAsync(new PlanningPokerException(errorMessage));
                    }
                }

                planningPokerService = planningPokerServiceMock.Object;
            }

            if (messageBoxService == null)
            {
                var messageBoxServiceMock = new Mock <IMessageBoxService>();
                if (memberExistsError)
                {
                    SetupReconnectMessageBox(messageBoxServiceMock, true);
                }

                messageBoxService = messageBoxServiceMock.Object;
            }

            if (busyIndicatorService == null)
            {
                var busyIndicatorServiceMock = new Mock <IBusyIndicatorService>();
                busyIndicatorService = busyIndicatorServiceMock.Object;
            }

            if (uriHelper == null)
            {
                var uriHelperMock = new Mock <IUriHelper>();
                uriHelper = uriHelperMock.Object;
            }

            if (memberCredentialsStore == null)
            {
                var memberCredentialsStoreMock = new Mock <IMemberCredentialsStore>();
                memberCredentialsStoreMock.Setup(o => o.GetCredentialsAsync()).ReturnsAsync(memberCredentials);
                memberCredentialsStore = memberCredentialsStoreMock.Object;
            }

            return(new JoinTeamController(planningPokerService, planningPokerInitializer, messageBoxService, busyIndicatorService, uriHelper, memberCredentialsStore));
        }
        public void JsonSerialize_ReconnectTeamResult_EstimationInProgress()
        {
            var scrumMaster = new TeamMember {
                Name = "master", Type = "ScrumMaster"
            };
            var teamMember = new TeamMember {
                Name = "John", Type = "Member"
            };

            var availableEstimations = new List <Estimation>
            {
                new Estimation {
                    Value = 1
                },
                new Estimation {
                    Value = 2
                }
            };

            var scrumTeam = new ScrumTeam
            {
                Name        = "Test Team",
                State       = TeamState.EstimationInProgress,
                ScrumMaster = scrumMaster,
                Members     = new List <TeamMember> {
                    scrumMaster, teamMember
                },
                Observers              = new List <TeamMember>(),
                AvailableEstimations   = availableEstimations,
                EstimationParticipants = new List <EstimationParticipantStatus>
                {
                    new EstimationParticipantStatus {
                        MemberName = teamMember.Name, Estimated = true
                    },
                    new EstimationParticipantStatus {
                        MemberName = scrumMaster.Name, Estimated = false
                    }
                }
            };

            var reconnectTeamResult = new ReconnectTeamResult
            {
                ScrumTeam          = scrumTeam,
                LastMessageId      = 5147483647,
                SelectedEstimation = availableEstimations[1]
            };

            var result = SerializeAndDeserialize(reconnectTeamResult);

            Assert.IsNotNull(result);
            Assert.AreEqual(reconnectTeamResult.LastMessageId, result.LastMessageId);
            Assert.AreEqual(reconnectTeamResult.SelectedEstimation.Value, result.SelectedEstimation.Value);

            var resultScrumTeam = result.ScrumTeam;

            Assert.AreEqual(scrumTeam.Name, resultScrumTeam.Name);
            Assert.AreEqual(scrumTeam.State, resultScrumTeam.State);
            Assert.AreEqual(scrumTeam.ScrumMaster.Name, resultScrumTeam.ScrumMaster.Name);
            Assert.AreEqual(scrumTeam.ScrumMaster.Type, resultScrumTeam.ScrumMaster.Type);
            Assert.AreEqual(scrumTeam.Members[0].Name, resultScrumTeam.Members[0].Name);
            Assert.AreEqual(scrumTeam.Members[0].Type, resultScrumTeam.Members[0].Type);
            Assert.AreEqual(scrumTeam.Members[1].Name, resultScrumTeam.Members[1].Name);
            Assert.AreEqual(scrumTeam.Members[1].Type, resultScrumTeam.Members[1].Type);
            Assert.AreEqual(scrumTeam.AvailableEstimations[0].Value, resultScrumTeam.AvailableEstimations[0].Value);
            Assert.AreEqual(scrumTeam.AvailableEstimations[1].Value, resultScrumTeam.AvailableEstimations[1].Value);
            Assert.AreEqual(scrumTeam.EstimationParticipants[0].MemberName, resultScrumTeam.EstimationParticipants[0].MemberName);
            Assert.AreEqual(scrumTeam.EstimationParticipants[0].Estimated, resultScrumTeam.EstimationParticipants[0].Estimated);
            Assert.AreEqual(scrumTeam.EstimationParticipants[1].MemberName, resultScrumTeam.EstimationParticipants[1].MemberName);
            Assert.AreEqual(scrumTeam.EstimationParticipants[1].Estimated, resultScrumTeam.EstimationParticipants[1].Estimated);
        }
 private void InitializeTeam(ReconnectTeamResult teamInfo)
 {
     LastMessageId       = teamInfo.LastMessageId;
     _selectedEstimation = teamInfo.SelectedEstimation;
 }