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 GetMessages_TeamAndMemberName_ReturnsMemberEstimatedMessage() { var messageJson = PlanningPokerClientData.GetMemberEstimatedMessageJson("22"); 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(22, message.Id); Assert.AreEqual(MessageType.MemberEstimated, message.Type); Assert.AreEqual(PlanningPokerClientData.ScrumMasterName, message.Member.Name); Assert.AreEqual(PlanningPokerClientData.ScrumMasterType, message.Member.Type); }