Ejemplo n.º 1
0
        public void When_Large_Bets_Exist_Then_Bet_Count_Is_Correct()
        {
            var largeBets = new LargeWinAmount(new List<UnsettledBetModel>
                {
                    new UnsettledBetModel
                        {
                            Id = 1,
                            CustomerId = 1,
                            CustomerName = string.Empty,
                            EventId = 1,
                            ParticipantId = 1,
                            Stake = 100,
                            ToWin = 1000
                        },
                    new UnsettledBetModel
                        {
                            Id = 2,
                            CustomerId = 2,
                            CustomerName = string.Empty,
                            EventId = 2,
                            ParticipantId = 2,
                            Stake = 100,
                            ToWin = 1500
                        },
                    new UnsettledBetModel
                        {
                            Id = 3,
                            CustomerId = 3,
                            CustomerName = string.Empty,
                            EventId = 3,
                            ParticipantId = 3,
                            Stake = 100,
                            ToWin = 500
                        }
                });

            var calculator = new BetCalculatorService();
            var result = calculator.DoCalculation(largeBets);

            Assert.AreEqual(result.Count, 2, "Incorrect number of bets with large win amount returned");
        }
Ejemplo n.º 2
0
        public void When_Unusual_Customers_Do_Not_Exist_Then_No_UnSettled_Bets_Returned()
        {
            var betsFromUnusualCustomers = new BetsFromUnusualCustomers(new List<UnsettledBetModel>
                {
                    new UnsettledBetModel
                        {
                            Id = 3,
                            CustomerId = 1,
                            CustomerName = string.Empty,
                            EventId = 5,
                            ParticipantId = 8,
                            Stake = 50,
                            ToWin = 200
                        },
                    new UnsettledBetModel
                        {
                            Id = 4,
                            CustomerId = 2,
                            CustomerName = string.Empty,
                            EventId = 5,
                            ParticipantId = 8,
                            Stake = 50,
                            ToWin = 400
                        }
                }, new List<CustomerModel>());

            var calculator = new BetCalculatorService();
            var result = calculator.DoCalculation(betsFromUnusualCustomers);

            Assert.IsNull(result, "Unsettled Bets returned for unusual customers when unusual customers do not exist");
        }
Ejemplo n.º 3
0
        public void When_No_Bets_10_Times_Higher_Than_Avg_Exist_Then_No_Records_Returned()
        {
            var betHigherThanAvg = new BetsHigherThanAvg(new List<UnsettledBetModel>
                {
                    new UnsettledBetModel
                        {
                            Id = 3,
                            CustomerId = 1,
                            CustomerName = string.Empty,
                            EventId = 5,
                            ParticipantId = 8,
                            Stake = 750,
                            ToWin = 3500
                        },
                    new UnsettledBetModel
                        {
                            Id = 4,
                            CustomerId = 2,
                            CustomerName = string.Empty,
                            EventId = 5,
                            ParticipantId = 8,
                            Stake = 450,
                            ToWin = 900
                        }
                }, new List<CustomerModel>
                    {
                        new CustomerModel {Id = 1, Fullname = string.Empty, AverageBet = 100},
                        new CustomerModel {Id = 2, Fullname = string.Empty, AverageBet = 50}
                    }, 10);

            var calculator = new BetCalculatorService();
            var result = calculator.DoCalculation(betHigherThanAvg);

            Assert.IsNull(result, "Zero not returned when higher than average bets do not exist");
        }