コード例 #1
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);
        }
コード例 #2
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);
        }
コード例 #3
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"));
        }
コード例 #4
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));
        }
コード例 #5
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());
        }
コード例 #6
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>()));
        }
コード例 #7
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"));
        }
コード例 #8
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));
        }
コード例 #9
0
        public async Task ReconnectTeam_MemberName_JoinTeamOnService(string memberName, bool asObserver)
        {
            var reconnectTeamResult  = PlanningPokerData.GetReconnectTeamResult();
            var planningPokerService = new Mock <IPlanningPokerClient>();

            planningPokerService.Setup(o => o.JoinTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <CancellationToken>()))
            .ThrowsAsync(new PlanningPokerException(ReconnectErrorMessage));
            planningPokerService.Setup(o => o.ReconnectTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(reconnectTeamResult);
            var target = CreateController(memberExistsError: true, 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>()));
        }
コード例 #10
0
        public async Task ReconnectTeam_TeamName_ShowsBusyIndicator()
        {
            var planningPokerService = new Mock <IPlanningPokerClient>();
            var busyIndicatorService = new Mock <IBusyIndicatorService>();
            var joinTeamTask         = new TaskCompletionSource <ScrumTeam>();
            var reconnectTeamTask    = new TaskCompletionSource <ReconnectTeamResult>();

            planningPokerService.Setup(o => o.JoinTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <CancellationToken>()))
            .Returns(joinTeamTask.Task);
            planningPokerService.Setup(o => o.ReconnectTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()))
            .Returns(reconnectTeamTask.Task);
            var target = CreateController(memberExistsError: true, planningPokerService: planningPokerService.Object, busyIndicatorService: busyIndicatorService.Object);

            var busyIndicatorInstance1 = new Mock <IDisposable>();

            busyIndicatorService.Setup(o => o.Show()).Returns(busyIndicatorInstance1.Object);

            var result = target.JoinTeam(PlanningPokerData.TeamName, PlanningPokerData.ObserverName, true);

            busyIndicatorService.Verify(o => o.Show());
            busyIndicatorInstance1.Verify(o => o.Dispose(), Times.Never());

            var busyIndicatorInstance2 = new Mock <IDisposable>();

            busyIndicatorService.Setup(o => o.Show()).Returns(busyIndicatorInstance2.Object);

            joinTeamTask.SetException(new PlanningPokerException(ReconnectErrorMessage));

            busyIndicatorService.Verify(o => o.Show(), Times.Exactly(2));
            busyIndicatorInstance1.Verify(o => o.Dispose());
            busyIndicatorInstance2.Verify(o => o.Dispose(), Times.Never());

            reconnectTeamTask.SetResult(PlanningPokerData.GetReconnectTeamResult());
            await result;

            busyIndicatorInstance2.Verify(o => o.Dispose());
        }