public ISdkTicket GetTicketResponseFromJson(string json, string routingKey, TicketResponseType type, string correlationId, IDictionary <string, string> additionalInfo) { //new if (type == TicketResponseType.Ticket) { var ticketDto = TicketResponseDTO.FromJson(json); return(Map(ticketDto, correlationId, additionalInfo, json)); } if (type == TicketResponseType.TicketCancel) { var cancelDto = TicketCancelResponseDTO.FromJson(json); return(Map(cancelDto, correlationId, additionalInfo, json)); } if (type == TicketResponseType.TicketCashout) { var cashoutDto = TicketCashoutResponseDTO.FromJson(json); return(Map(cashoutDto, correlationId, additionalInfo, json)); } if (type == TicketResponseType.TicketNonSrSettle) { var nonSrSettleDto = TicketNonSrSettleResponseDTO.FromJson(json); return(Map(nonSrSettleDto, correlationId, additionalInfo, json)); } //old if (!routingKey.Contains("cancel")) { var ticketDto = TicketResponseDTO.FromJson(json); return(Map(ticketDto, correlationId, additionalInfo, json)); } var cancel2Dto = TicketCancelResponseDTO.FromJson(json); return(Map(cancel2Dto, correlationId, additionalInfo, json)); }
public void BuildTicketResponseFromTicketResponseDtoTest() { var json = FileHelper.ReadFile(DirPath, @"ticket-response2.json"); var dto = TicketResponseDTO.FromJson(json); var ticket = new TicketResponseMapper(null).Map(dto, SR.S1000, null, dto.ToJson()); TicketCompareHelper.Compare(ticket, dto); }
public void BuildTicketResponseFromTicketResponseJson_ReceivedFromCustomerTest() { var json = FileHelper.ReadFile(DirPath, @"ticket-response-customer.json"); var dto = TicketResponseDTO.FromJson(json); var ticket = new TicketResponseMapper(null).Map(dto, SR.S1000, null, dto.ToJson()); TicketCompareHelper.Compare(ticket, dto); Assert.IsNotNull(ticket.BetDetails); Assert.IsNotNull(dto.Result.BetDetails.First().SelectionDetails); Assert.IsNull(ticket.BetDetails.First().SelectionDetails); }
public void BuildTicketResponseDtoFromJson2Test() { var json = FileHelper.ReadFile(DirPath, @"ticket-response2.json"); var dto = TicketResponseDTO.FromJson(json); Assert.IsNotNull(dto); Assert.IsNotNull(dto.Result); Assert.AreEqual(Status.Rejected, dto.Result.Status); Assert.IsNotNull(dto.Result.Reason); Assert.AreEqual(-422, dto.Result.Reason.Code); Assert.AreEqual("2.0", dto.Version); }
public void BuildTicketResponseDtoFromJsonTest() { var json = FileHelper.ReadFile(DirPath, @"ticket-response.json"); var dto = TicketResponseDTO.FromJson(json); Assert.IsNotNull(dto); Assert.IsNotNull(dto.Result); Assert.AreEqual(dto.Result.Status, Status.Accepted); Assert.IsNotNull(dto.Result.Reason); Assert.AreEqual(dto.Result.Reason.Code, 1024); Assert.AreEqual(dto.Version, "2.0"); }
public void BuildTicketResponseDtoFromJson4_MissingSelectionDetailsTest() { var json = FileHelper.ReadFile(DirPath, @"ticket-response4.json"); var dto = TicketResponseDTO.FromJson(json); Assert.IsNotNull(dto); Assert.IsNotNull(dto.Result); Assert.AreEqual(Status.Rejected, dto.Result.Status); Assert.IsNotNull(dto.Result.Reason); Assert.AreEqual(-321, dto.Result.Reason.Code); Assert.AreEqual("2.0", dto.Version); Assert.IsNotNull(dto.Result.BetDetails); Assert.IsNotNull(dto.Result.BetDetails.First().SelectionDetails); Assert.IsTrue(!dto.Result.BetDetails.First().SelectionDetails.Any()); }