Example #1
0
        public void TestWinnerOutcome()
        {
            Cars.StartingPosition1 = 0;
            Cars.RacetrackLength1  = 50;
            int carRaceAmount = 45;
            int CarsNumber    = 2;
            int expectedWin   = 90;
            int expectedLose  = 0;

            Carss[0] = new Cars()
            {
                CarsPictureBox = null
            };
            Carss[1] = new Cars()
            {
                CarsPictureBox = null
            };
            Lim      = pFactory.getRacer("Lim", null, null);
            Lim.Cash = carRaceAmount;
            Lim.PlaceBet((int)carRaceAmount, CarsNumber);

            bool nowin = true;
            int  win   = -1;

            while (nowin)
            {
                for (int i = 0; i < Carss.Length; i++)
                {
                    if (Cars.Run(Carss[i]))
                    {
                        win = i + 1;
                        Lim.Collect(win);
                        nowin = false;
                    }
                }
            }
            if (Lim.bet.carNum == win)
            {
                Assert.AreEqual(expectedWin, Lim.Cash, "Account not credited correctly");
            }
            if (Lim.bet.carNum != win)
            {
                Assert.AreEqual(expectedLose, Lim.Cash, "Account not debited correctly");
            }
        }
Example #2
0
        public void TestWinnerOutcome()
        {
            Dogs.startline1 = 0;
            Dogs.rtlength1  = 50;
            int carRaceAmount = 45;
            int DogsNumber    = 2;
            int expectedWin   = 90;
            int expectedLose  = 0;

            Dogss[0] = new Dogs()
            {
                DogsPictureBox = null
            };
            Dogss[1] = new Dogs()
            {
                DogsPictureBox = null
            };
            Player1      = pFactory.getRacer("player1", null, null);
            Player1.Cash = carRaceAmount;
            Player1.PlaceBet((int)carRaceAmount, DogsNumber);

            bool nowin = true;
            int  win   = -1;

            while (nowin)
            {
                for (int i = 0; i < Dogss.Length; i++)
                {
                    if (Dogs.Run(Dogss[i]))
                    {
                        win = i + 1;
                        Player1.Collect(win);
                        nowin = false;
                    }
                }
            }
            if (Player1.bet.dogNum == win)
            {
                Assert.AreEqual(expectedWin, Player1.Cash, "Account not credited correctly");
            }
            if (Player1.bet.dogNum != win)
            {
                Assert.AreEqual(expectedLose, Player1.Cash, "Account not debited correctly");
            }
        }
Example #3
0
        public void TestWinnerOutcome()
        {
            Trucks.StartingPosition1 = 0;
            Trucks.RacetrackLength1  = 50;
            int TruckRaceAmount = 50;
            int TrucksNumber    = 1;
            int expectedWin     = 100;
            int expectedLose    = 0;

            Truckss[0] = new Trucks()
            {
                TrucksPictureBox = null
            };
            //  Truckss[1] = new Trucks() { TrucksPictureBox = null };
            Lovedeep      = Obj_Factory.getRacer("Lovedeep", null, null);
            Lovedeep.Cash = TruckRaceAmount;
            Lovedeep.PlaceBet((int)TruckRaceAmount, TrucksNumber);

            bool nowin = true;
            int  win   = -1;

            while (nowin)
            {
                for (int i = 0; i < Truckss.Length; i++)
                {
                    if (Trucks.Run(Truckss[i]))
                    {
                        win = i + 1;
                        Lovedeep.Collect(win);
                        nowin = false;
                    }
                }
            }
            if (Lovedeep.bet.TruckNum == win)
            {
                Assert.AreEqual(expectedWin, Lovedeep.Cash, "Account not credited correctly");
            }
            if (Lovedeep.bet.TruckNum != win)
            {
                Assert.AreEqual(expectedLose, Lovedeep.Cash, "Account not debited correctly");
            }
        }