public async Task JoinTeam_TeamAndMemberName_ReturnsScrumTeamWithEstimationFinishedAndEstimationIsInfinity() { var estimationResultJson = PlanningPokerClientData.GetEstimationResultJson(scrumMasterEstimation: "-1111100", memberEstimation: "null"); var httpMock = new MockHttpMessageHandler(); httpMock.When(BaseUrl + $"api/PlanningPokerService/JoinTeam") .Respond(JsonType, PlanningPokerClientData.GetScrumTeamJson(member: true, observer: true, state: 2, estimationResult: estimationResultJson)); var target = CreatePlanningPokerClient(httpMock); var result = await target.JoinTeam(PlanningPokerClientData.TeamName, PlanningPokerClientData.MemberName, false, CancellationToken.None); Assert.IsNotNull(result); Assert.AreEqual(TeamState.EstimationFinished, result.State); Assert.AreEqual(PlanningPokerClientData.TeamName, result.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, result.ScrumMaster.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, result.ScrumMaster.Type); Assert.AreEqual(2, result.Members.Count); var member = result.Members[0]; Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, member.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, member.Type); member = result.Members[1]; Assert.AreEqual(PlanningPokerClientData.MemberName, member.Name); Assert.AreEqual(PlanningPokerClientData.MemberType, member.Type); Assert.AreEqual(1, result.Observers.Count); member = result.Observers[0]; Assert.AreEqual(PlanningPokerClientData.ObserverName, member.Name); Assert.AreEqual(PlanningPokerClientData.ObserverType, member.Type); AssertAvailableEstimations(result); Assert.AreEqual(2, result.EstimationResult.Count); var estimationResult = result.EstimationResult[0]; Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, estimationResult.Member.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, estimationResult.Member.Type); Assert.IsTrue(double.IsPositiveInfinity(estimationResult.Estimation.Value.Value)); estimationResult = result.EstimationResult[1]; Assert.AreEqual(PlanningPokerClientData.MemberName, estimationResult.Member.Name); Assert.AreEqual(PlanningPokerClientData.MemberType, estimationResult.Member.Type); Assert.IsNull(estimationResult.Estimation.Value); Assert.AreEqual(0, result.EstimationParticipants.Count); }
public async Task GetMessages_TeamAndMemberName_ReturnsEmptyMessage() { var messageJson = PlanningPokerClientData.GetEmptyMessageJson(); var httpMock = new MockHttpMessageHandler(); httpMock.When(PlanningPokerClientTest.BaseUrl + $"api/PlanningPokerService/GetMessages") .Respond(PlanningPokerClientTest.JsonType, PlanningPokerClientData.GetMessagesJson(messageJson)); var target = PlanningPokerClientTest.CreatePlanningPokerClient(httpMock); var result = await target.GetMessages(PlanningPokerClientData.TeamName, PlanningPokerClientData.MemberName, Guid.NewGuid(), 0, CancellationToken.None); Assert.AreEqual(1, result.Count); var message = result[0]; Assert.AreEqual(0, message.Id); Assert.AreEqual(MessageType.Empty, message.Type); }
public async Task GetMessages_TeamAndMemberName_Returns3Messages() { var estimationStartedMessageJson = PlanningPokerClientData.GetEstimationStartedMessageJson("8"); var memberEstimatedMessageJson = PlanningPokerClientData.GetMemberEstimatedMessageJson("9"); var estimationEndedMessageJson = PlanningPokerClientData.GetEstimationEndedMessage2Json("10"); var json = PlanningPokerClientData.GetMessagesJson(estimationStartedMessageJson, memberEstimatedMessageJson, estimationEndedMessageJson); var httpMock = new MockHttpMessageHandler(); httpMock.When(PlanningPokerClientTest.BaseUrl + $"api/PlanningPokerService/GetMessages") .Respond(PlanningPokerClientTest.JsonType, json); var target = PlanningPokerClientTest.CreatePlanningPokerClient(httpMock); var result = await target.GetMessages(PlanningPokerClientData.TeamName, PlanningPokerClientData.MemberName, Guid.NewGuid(), 0, CancellationToken.None); Assert.AreEqual(3, result.Count); var message = result[0]; Assert.AreEqual(8, message.Id); Assert.AreEqual(MessageType.EstimationStarted, message.Type); Assert.IsInstanceOfType(result[1], typeof(MemberMessage)); var memberMessage = (MemberMessage)result[1]; Assert.AreEqual(9, memberMessage.Id); Assert.AreEqual(MessageType.MemberEstimated, memberMessage.Type); Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, memberMessage.Member.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, memberMessage.Member.Type); Assert.IsInstanceOfType(result[2], typeof(EstimationResultMessage)); var estimationMessage = (EstimationResultMessage)result[2]; Assert.AreEqual(10, estimationMessage.Id); Assert.AreEqual(MessageType.EstimationEnded, estimationMessage.Type); Assert.AreEqual(2, estimationMessage.EstimationResult.Count); var estimationResult = estimationMessage.EstimationResult[0]; Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, estimationResult.Member.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, estimationResult.Member.Type); Assert.AreEqual(5.0, estimationResult.Estimation.Value); estimationResult = estimationMessage.EstimationResult[1]; Assert.AreEqual(PlanningPokerClientData.MemberName, estimationResult.Member.Name); Assert.AreEqual(PlanningPokerClientData.MemberType, estimationResult.Member.Type); Assert.AreEqual(40.0, estimationResult.Estimation.Value); }
public async Task JoinTeam_TeamAndMemberName_ReturnsScrumTeamWithEstimationInProgress() { var estimationParticipantsJson = PlanningPokerClientData.GetEstimationParticipantsJson(); var httpMock = new MockHttpMessageHandler(); httpMock.When(BaseUrl + $"api/PlanningPokerService/JoinTeam") .Respond(JsonType, PlanningPokerClientData.GetScrumTeamJson(member: true, state: 1, estimationParticipants: estimationParticipantsJson)); var target = CreatePlanningPokerClient(httpMock); var result = await target.JoinTeam(PlanningPokerClientData.TeamName, PlanningPokerClientData.MemberName, false, CancellationToken.None); Assert.IsNotNull(result); Assert.AreEqual(TeamState.EstimationInProgress, result.State); Assert.AreEqual(PlanningPokerClientData.TeamName, result.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, result.ScrumMaster.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, result.ScrumMaster.Type); Assert.AreEqual(2, result.Members.Count); var member = result.Members[0]; Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, member.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, member.Type); member = result.Members[1]; Assert.AreEqual(PlanningPokerClientData.MemberName, member.Name); Assert.AreEqual(PlanningPokerClientData.MemberType, member.Type); Assert.AreEqual(0, result.Observers.Count); AssertAvailableEstimations(result); Assert.AreEqual(0, result.EstimationResult.Count); Assert.AreEqual(2, result.EstimationParticipants.Count); var estimationParticipant = result.EstimationParticipants[0]; Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, estimationParticipant.MemberName); Assert.IsTrue(estimationParticipant.Estimated); estimationParticipant = result.EstimationParticipants[1]; Assert.AreEqual(PlanningPokerClientData.MemberName, estimationParticipant.MemberName); Assert.IsFalse(estimationParticipant.Estimated); }
public async Task GetMessages_TeamAndMemberName_ReturnsMemberDisconnectedMessage() { var messageJson = PlanningPokerClientData.GetMemberDisconnectedMessageJson("2", name: PlanningPokerClientData.ObserverName, type: PlanningPokerClientData.ObserverType); var httpMock = new MockHttpMessageHandler(); httpMock.When(PlanningPokerClientTest.BaseUrl + $"api/PlanningPokerService/GetMessages") .Respond(PlanningPokerClientTest.JsonType, PlanningPokerClientData.GetMessagesJson(messageJson)); var target = PlanningPokerClientTest.CreatePlanningPokerClient(httpMock); var result = await target.GetMessages(PlanningPokerClientData.TeamName, PlanningPokerClientData.MemberName, Guid.NewGuid(), 0, CancellationToken.None); Assert.AreEqual(1, result.Count); Assert.IsInstanceOfType(result[0], typeof(MemberMessage)); var message = (MemberMessage)result[0]; Assert.AreEqual(2, message.Id); Assert.AreEqual(MessageType.MemberDisconnected, message.Type); Assert.AreEqual(PlanningPokerClientData.ObserverName, message.Member.Name); Assert.AreEqual(PlanningPokerClientData.ObserverType, message.Member.Type); }
public async Task ReconnectTeam_TeamAndMemberName_ReturnsScrumTeam() { var scrumTeamJson = PlanningPokerClientData.GetScrumTeamJson(member: true); var httpMock = new MockHttpMessageHandler(); httpMock.When(BaseUrl + $"api/PlanningPokerService/ReconnectTeam") .Respond(JsonType, PlanningPokerClientData.GetReconnectTeamResultJson(scrumTeamJson)); var target = CreatePlanningPokerClient(httpMock); var result = await target.ReconnectTeam(PlanningPokerClientData.TeamName, PlanningPokerClientData.MemberName, CancellationToken.None); Assert.IsNotNull(result.ScrumTeam); Assert.AreEqual(PlanningPokerClientData.ReconnectSessionId, result.SessionId); Assert.AreEqual(0, result.LastMessageId); Assert.IsNull(result.SelectedEstimation); var scrumTeam = result.ScrumTeam; Assert.AreEqual(TeamState.Initial, scrumTeam.State); Assert.AreEqual(PlanningPokerClientData.TeamName, scrumTeam.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, scrumTeam.ScrumMaster.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, scrumTeam.ScrumMaster.Type); Assert.AreEqual(2, scrumTeam.Members.Count); var member = scrumTeam.Members[0]; Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, member.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, member.Type); member = scrumTeam.Members[1]; Assert.AreEqual(PlanningPokerClientData.MemberName, member.Name); Assert.AreEqual(PlanningPokerClientData.MemberType, member.Type); Assert.AreEqual(0, scrumTeam.Observers.Count); AssertAvailableEstimations(scrumTeam); Assert.AreEqual(0, scrumTeam.EstimationResult.Count); Assert.AreEqual(0, scrumTeam.EstimationParticipants.Count); }
public async Task GetMessages_TeamAndMemberName_ReturnsEstimationEndedMessage() { var messageJson = PlanningPokerClientData.GetEstimationEndedMessageJson("8"); var httpMock = new MockHttpMessageHandler(); httpMock.When(PlanningPokerClientTest.BaseUrl + $"api/PlanningPokerService/GetMessages") .Respond(PlanningPokerClientTest.JsonType, PlanningPokerClientData.GetMessagesJson(messageJson)); var target = PlanningPokerClientTest.CreatePlanningPokerClient(httpMock); var result = await target.GetMessages(PlanningPokerClientData.TeamName, PlanningPokerClientData.MemberName, Guid.NewGuid(), 0, CancellationToken.None); Assert.AreEqual(1, result.Count); Assert.IsInstanceOfType(result[0], typeof(EstimationResultMessage)); var message = (EstimationResultMessage)result[0]; Assert.AreEqual(8, message.Id); Assert.AreEqual(MessageType.EstimationEnded, message.Type); Assert.AreEqual(4, message.EstimationResult.Count); var estimationResult = message.EstimationResult[0]; Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, estimationResult.Member.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, estimationResult.Member.Type); Assert.AreEqual(2.0, estimationResult.Estimation.Value); estimationResult = message.EstimationResult[1]; Assert.AreEqual(PlanningPokerClientData.MemberName, estimationResult.Member.Name); Assert.AreEqual(PlanningPokerClientData.MemberType, estimationResult.Member.Type); Assert.IsNull(estimationResult.Estimation.Value); estimationResult = message.EstimationResult[2]; Assert.AreEqual("Me", estimationResult.Member.Name); Assert.AreEqual(PlanningPokerClientData.MemberType, estimationResult.Member.Type); Assert.IsNull(estimationResult.Estimation); estimationResult = message.EstimationResult[3]; Assert.AreEqual(PlanningPokerClientData.ObserverName, estimationResult.Member.Name); Assert.AreEqual(PlanningPokerClientData.MemberType, estimationResult.Member.Type); Assert.IsTrue(double.IsPositiveInfinity(estimationResult.Estimation.Value.Value)); }