public void CheckRequiredTicketFieldsTest() { var ticket = TicketBuilderHelper.GetTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(json.Contains("totalCombinations"), "missing totalCombinations"); }
public void SerializeTicketTest() { var ticket = TicketBuilderHelper.GetTicket(); var serialized = JsonConvert.SerializeObject(ticket); var deserializedTicket = JsonUtils.Deserialize <ITicket>(serialized); var serializedAgain = JsonUtils.Serialize(deserializedTicket); Assert.AreEqual(serialized, serializedAgain); }
public void TicketToJsonTest() { var ticket = TicketBuilderHelper.GetTicket(); var dto = new TicketMapper().Map(ticket); var ticketJson = ticket.ToJson(); var dtoJson = dto.ToJson(); CheckRequiredFields(ticketJson); CheckRequiredFields(dtoJson); Assert.AreEqual(ticketJson, dtoJson); }
public void BuildTicketAltStakeTest() { var ticket = TicketBuilderHelper.GetTicket(); var ticketResponseDto = TicketBuilderHelper.GetTicketResponse(ticket, Status.Rejected, false, true); var ticketResponse = new TicketResponseMapper(null).Map(ticketResponseDto, S1000, null, ticketResponseDto.ToJson()); Thread.Sleep(500); var reofferTicket = new BuilderFactoryHelper().BuilderFactory.CreateAltStakeBuilder().Set(ticket, ticketResponse, "altStakeTicket-" + I1000P).BuildTicket(); Assert.IsNotNull(reofferTicket); TicketCompareHelper.Compare(ticket, reofferTicket, false, true); }
public void BuildTicketDtoFromTicketTest() { var ticket = TicketBuilderHelper.GetTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); var newDto = new TicketDTO { Ticket = Ticket.FromJson(json) }; TicketCompareHelper.Compare(ticket, dto); TicketCompareHelper.Compare(ticket, newDto); }