Exemplo n.º 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");
            }
        }
Exemplo n.º 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");
            }
        }