Exemplo n.º 1
0
        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-"));
        }
Exemplo n.º 2
0
        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"));
        }
Exemplo n.º 3
0
        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"));
        }
Exemplo n.º 4
0
        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"));
        }
Exemplo n.º 5
0
        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");
        }
Exemplo n.º 6
0
        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"));
        }
Exemplo n.º 7
0
        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));
        }
Exemplo n.º 8
0
        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"));
        }
Exemplo n.º 9
0
        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"));
        }
Exemplo n.º 10
0
        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"));
        }
Exemplo n.º 11
0
        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");
        }