public void CheckWithBetIdTest() { var ticketBuilder = TicketBuilderHelper.GetTicketBuilder(_sender); var betBuilder = _builderFactory.CreateBetBuilder(); betBuilder.AddSelection(_builderFactory.CreateSelectionBuilder().SetEventId(SR.S1000P).SetIdLcoo(SR.I1000, 1, "", "1").SetOdds(SR.I1000P).SetBanker(SR.I100 > 90).Build()); var bet = betBuilder.AddSelectedSystem(1).SetStake(SR.I1000P, StakeType.Total).SetBetId("bet-id-" + SR.I1000).Build(); ticketBuilder.AddBet(bet); var ticket = ticketBuilder.BuildTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); Assert.IsNotNull(json); Assert.IsTrue(!string.IsNullOrEmpty(json)); CheckRequiredFields(json); var i = json.IndexOf("bets", StringComparison.InvariantCultureIgnoreCase); var betSection = json.Substring(i > 0 ? i : 0); i = betSection.IndexOf("ticketId", StringComparison.InvariantCultureIgnoreCase); betSection = betSection.Substring(0, i > 0 ? i : betSection.Length); Assert.IsTrue(betSection.Contains("id")); Assert.IsTrue(betSection.Contains("bet-id-")); }
public void CheckWithBetBonusTest() { var ticketBuilder = TicketBuilderHelper.GetTicketBuilder(_sender); var betBuilder = _builderFactory.CreateBetBuilder(); betBuilder.AddSelection(_builderFactory.CreateSelectionBuilder().SetEventId(SR.S1000P).SetIdLcoo(SR.I1000, 1, "", "1").SetOdds(SR.I1000P).SetBanker(SR.I100 > 90).Build()); var bet = betBuilder.AddSelectedSystem(1).SetStake(SR.I1000P, StakeType.Unit).SetBetBonus(SR.I1000P).SetBetId("bet-id-" + SR.I1000).Build(); ticketBuilder.AddBet(bet); ticketBuilder.SetTotalCombinations(ticketBuilder.GetBets().Count()); var ticket = ticketBuilder.BuildTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(json.Contains("bonus")); Assert.IsTrue(json.Contains("mode")); Assert.IsTrue(json.Contains("all")); Assert.IsTrue(json.Contains("total")); Assert.IsTrue(json.Contains("unit")); }
public void CheckOddsChangeEnumValuesTest() { var ticket = TicketBuilderHelper.GetTicketBuilder(_sender, null, 1, 2).SetOddsChange(OddsChangeType.Higher).BuildTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(json.Contains("oddsChange")); Assert.IsTrue(json.Contains("higher")); }
public void CheckNoTicketAltStakeRefIdTest() { var ticketBuilder = TicketBuilderHelper.GetTicketBuilder(_sender, null, 2, 2); var ticket = ticketBuilder.BuildTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(!json.Contains("altStakeRefId")); }
public void CheckNoOddsChangeEnumValuesTest() { var ticket = TicketBuilderHelper.GetTicketBuilder(_sender, null, 1, 2).BuildTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(json.Contains("totalCombinations"), "missing totalCombinations"); Assert.IsTrue(!json.Contains("oddsChange"), "extra oddsChange"); Assert.IsTrue(!json.Contains("higher"), "extra higher"); Assert.IsTrue(!json.Contains("none"), "extra none"); }
public void CheckWithAutoTicketAltStakeRefIdTest() { var ticketBuilder = TicketBuilderHelper.GetTicketBuilder(_sender, null, 1, 1); var ticket = ticketBuilder.BuildTicket(); var altStakeRefId = "A-" + SR.S1000; var altStakeTicket = _builderFactory.CreateAltStakeBuilder().Set(ticket, 200000, altStakeRefId).BuildTicket(); var dto = new TicketMapper().Map(altStakeTicket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(json.Contains("altStakeRefId")); Assert.IsTrue(json.Contains(ticket.TicketId)); Assert.IsTrue(json.Contains(altStakeRefId)); Assert.IsTrue(json.Contains("200000")); }
public void CheckWithTicketReofferRefIdTest() { var ticketBuilder = TicketBuilderHelper.GetTicketBuilder(_sender, null, 2, 2); var reofferRefId = "R-" + SR.S1000; ticketBuilder.SetReofferId(reofferRefId); var ticket = ticketBuilder.BuildTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(json.Contains("reofferRefId")); Assert.IsTrue(json.Contains(reofferRefId)); }
public void CheckWithEmptyEndCustomerTest() { var endCustomer = _builderFactory.CreateEndCustomerBuilder().Build(); var ticketBuilder = TicketBuilderHelper.GetTicketBuilder(null, endCustomer, 1, 1); var ticket = ticketBuilder.BuildTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(json.Contains("endCustomer")); Assert.IsTrue(!json.Contains("ip")); Assert.IsTrue(!json.Contains("deviceId")); Assert.IsTrue(!json.Contains("languageId")); Assert.IsTrue(!json.Contains("confidence")); }
public void CheckNoEndCustomerConfidenceTest() { var endCustomer = _builderFactory.CreateEndCustomerBuilder() .SetId("customer-client-" + SR.I1000) .SetIp(IPAddress.Loopback) .SetLanguageId("en") .SetDeviceId("123") .Build(); var ticketBuilder = TicketBuilderHelper.GetTicketBuilder(null, endCustomer, 5, 10); var ticket = ticketBuilder.BuildTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(!json.Contains("confidence")); }
public void CheckNoSumOfWinsTest() { var ticketBuilder = TicketBuilderHelper.GetTicketBuilder(_sender); var betBuilder = _builderFactory.CreateBetBuilder(); betBuilder.AddSelection(_builderFactory.CreateSelectionBuilder().SetEventId(SR.S1000P).SetIdLcoo(SR.I1000, 1, "", "1").SetOdds(SR.I1000P).SetBanker(SR.I100 > 90).Build()); var bet = betBuilder.AddSelectedSystem(1).SetStake(SR.I1000P, StakeType.Total).SetBetId("bet-id-" + SR.I1000).Build(); ticketBuilder.AddBet(bet); var ticket = ticketBuilder.BuildTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(!json.Contains("sumOfWins")); }
public void CheckWithStakeTypeTest() { var ticketBuilder = TicketBuilderHelper.GetTicketBuilder(_sender); var betBuilder = _builderFactory.CreateBetBuilder(); betBuilder.AddSelection(_builderFactory.CreateSelectionBuilder().SetEventId(SR.I1000P).SetIdLcoo(SR.I1000, 1, "", "1").SetOdds(SR.I1000P).SetBanker(SR.I100 > 90).Build()); var bet = betBuilder.AddSelectedSystem(1).SetStake(SR.I1000P, StakeType.Unit).SetBetId("bet-id-" + SR.I1000).Build(); ticketBuilder.AddBet(bet); var ticket = ticketBuilder.BuildTicket(); var dto = new TicketMapper().Map(ticket); var json = dto.ToJson(); CheckRequiredFields(json); Assert.IsTrue(json.Contains("stake"), "missing stake"); Assert.IsTrue(json.Contains("type"), "missing type"); Assert.IsTrue(!json.Contains("total"), "extra total"); Assert.IsTrue(json.Contains("unit"), "missing unit"); }