public void BuildTicketWithNoCodeTest()
        {
            var tb     = TicketCashoutBuilder.Create();
            var ticket = tb.SetTicketId("ticket-" + SR.I1000P)
                         .SetBookmakerId(SR.I1000)
                         .BuildTicket();

            Assert.IsNull(ticket);
        }
        public void BuildTicketWithNoTicketIdTest()
        {
            var tb     = TicketCashoutBuilder.Create();
            var ticket = tb.SetBookmakerId(SR.I1000)
                         .SetCashoutStake(1000)
                         .BuildTicket();

            Assert.IsNull(ticket);
        }
        public void BuildTicketBetCashoutAndPercentTest()
        {
            var tb = TicketCashoutBuilder.Create();

            tb.SetTicketId("ticket-" + SR.I1000P)
            .SetBookmakerId(SR.I1000)
            .SetCashoutPercent(2132)
            .AddBetCashout("bet-id-02", 123, null)
            .BuildTicket();
        }
        public void BuildTicketTooLowPercentTest()
        {
            var tb     = TicketCashoutBuilder.Create();
            var ticket = tb.SetTicketId("ticket-" + SR.I1000P)
                         .SetBookmakerId(SR.I1000)
                         .SetCashoutStake(0)
                         .SetCashoutPercent(0)
                         .BuildTicket();

            Assert.IsNotNull(ticket);
        }
        public void BuildTicketValidPercentTest()
        {
            var tb = TicketCashoutBuilder.Create();

            tb.SetCashoutPercent(1)
            .SetCashoutPercent(1000000)
            .SetCashoutPercent(10101);

            var ticket = tb.SetBookmakerId(1).SetTicketId("ticket-01").SetCashoutStake(1000).BuildTicket();

            Assert.IsNotNull(ticket);
            Assert.IsNotNull(ticket.CashoutPercent);
            Assert.AreEqual(10101, ticket.CashoutPercent);
        }
        public void BuildBaseTicketTest()
        {
            var tb     = TicketCashoutBuilder.Create();
            var ticket = tb.SetTicketId("ticket-" + SR.I1000P)
                         .SetBookmakerId(SR.I1000)
                         .SetCashoutStake(1000)
                         .BuildTicket();

            Assert.IsNotNull(ticket);
            Assert.IsTrue(ticket.Timestamp > DateTime.Today.ToUniversalTime());
            Assert.AreEqual(TicketHelper.MtsTicketVersion, ticket.Version);
            Assert.IsTrue(TicketHelper.ValidateTicketId(ticket.TicketId));
            Assert.IsNull(ticket.CashoutPercent);
            Assert.IsNull(ticket.BetCashouts);
            Assert.IsNotNull(ticket.CashoutStake);
            Assert.AreEqual(1000, ticket.CashoutStake);
        }
        public void BuildTicketBetCashoutPercentLowTest()
        {
            var tb = TicketCashoutBuilder.Create();

            tb.AddBetCashout("bet-id-01", 1000, 0);

            var ticket = tb.SetBookmakerId(1).SetTicketId("ticket-01").BuildTicket();

            Assert.IsNotNull(ticket);
            Assert.IsNull(ticket.CashoutPercent);
            Assert.IsNull(ticket.CashoutStake);
            Assert.IsNotNull(ticket.BetCashouts);
            Assert.AreEqual(1, ticket.BetCashouts.Count());
            Assert.IsNotNull(ticket.BetCashouts.First().CashoutPercent);
            Assert.IsNotNull(ticket.BetCashouts.First().CashoutStake);
            Assert.AreEqual(0, ticket.BetCashouts.First().CashoutPercent);
            Assert.AreEqual(1000, ticket.BetCashouts.First().CashoutStake);
        }
        public void BuildTicketPercentTest()
        {
            var tb     = TicketCashoutBuilder.Create();
            var ticket = tb.SetTicketId("ticket-" + SR.I1000P)
                         .SetBookmakerId(SR.I1000)
                         .SetCashoutStake(1000)
                         .SetCashoutPercent(2132)
                         .BuildTicket();
            var dto = new TicketCashoutMapper().Map(ticket);

            Assert.IsNotNull(ticket);
            Assert.IsTrue(ticket.Timestamp > DateTime.Today.ToUniversalTime());
            Assert.IsNotNull(ticket.CashoutPercent);
            Assert.IsNull(ticket.BetCashouts);
            Assert.IsNotNull(ticket.CashoutStake);
            Assert.AreEqual(1000, ticket.CashoutStake);
            Assert.AreEqual(2132, ticket.CashoutPercent);
            Assert.AreEqual(ticket.CashoutPercent, dto.CashoutPercent);
            Assert.IsNull(ticket.BetCashouts);
            Assert.IsNull(dto.BetCashout);
        }
        public void BuildTicketBetCashoutTest()
        {
            var tb     = TicketCashoutBuilder.Create();
            var ticket = tb.SetTicketId("ticket-" + SR.I1000P)
                         .SetBookmakerId(SR.I1000)
                         .AddBetCashout("bet-id-01", 1000, 2132)
                         .AddBetCashout("bet-id-02", 1000, null)
                         .BuildTicket();
            var dto = new TicketCashoutMapper().Map(ticket);

            Assert.IsNotNull(ticket);
            Assert.IsTrue(ticket.Timestamp > DateTime.Today.ToUniversalTime());
            Assert.IsNull(ticket.CashoutStake);
            Assert.IsNull(ticket.CashoutPercent);
            Assert.IsNotNull(ticket.BetCashouts);
            Assert.AreEqual(2, ticket.BetCashouts.Count());
            Assert.AreEqual(ticket.CashoutPercent, dto.CashoutPercent);
            Assert.AreEqual("bet-id-01", dto.BetCashout.First().Id);
            Assert.AreEqual("bet-id-02", dto.BetCashout.ToList()[1].Id);
            Assert.AreEqual(1000, dto.BetCashout.First().CashoutStake);
            Assert.AreEqual(1000, dto.BetCashout.ToList()[1].CashoutStake);
            Assert.AreEqual(2132, dto.BetCashout.First().CashoutPercent);
            Assert.IsNull(dto.BetCashout.ToList()[1].CashoutPercent);
        }
        public void BuildTicketTooHighPercentTest()
        {
            var tb = TicketCashoutBuilder.Create();

            tb.SetCashoutPercent(1000001);
        }
        public void BuildTicketBetCashoutPercentHighTest()
        {
            var tb = TicketCashoutBuilder.Create();

            tb.AddBetCashout("bet-id-01", 1000, 1000001);
        }
        public void BuildTicketBetCashoutStakeLowTest()
        {
            var tb = TicketCashoutBuilder.Create();

            tb.AddBetCashout("bet-id-01", 0, 1220);
        }
        public void BuildTicketBetCashoutMissingBetIdTest()
        {
            var tb = TicketCashoutBuilder.Create();

            tb.AddBetCashout("", 1000, 1220);
        }