示例#1
0
        public void TestWinnerOutcome()
        {
            Horse.StartingPosition1 = 0;
            Horse.RacetrackLength1  = 50;
            int BettingAmount = 20;
            int HorseNumber   = 1;
            int expectedWin   = 40;
            int expectedLose  = 0;

            horses[0] = new Horse()
            {
                HorsePictureBox = null
            };
            horses[1] = new Horse()
            {
                HorsePictureBox = null
            };
            Sahib      = pFactory.getPunter("Sahib", null, null);
            Sahib.Cash = BettingAmount;
            Sahib.PlaceBet((int)BettingAmount, HorseNumber);

            bool nowin = true;
            int  win   = -1;

            while (nowin)
            {
                for (int i = 0; i < horses.Length; i++)
                {
                    if (Horse.Run(horses[i]))
                    {
                        win = i + 1;
                        Sahib.Collect(win);
                        nowin = false;
                    }
                }
            }
            if (Sahib.bet.horseNum == win)
            {
                Assert.AreEqual(expectedWin, Sahib.Cash, "Account not credited correctly");
            }
            if (Sahib.bet.horseNum != win)
            {
                Assert.AreEqual(expectedLose, Sahib.Cash, "Account not debited correctly");
            }
        }
示例#2
0
        public void TestWinnerOutcome()
        {
            OX.StartingPosition1 = 0;
            OX.RacetrackLength1  = 50;
            int BettingAmount = 50;
            int OXNumber      = 1;
            int expectedWin   = 100;
            int expectedLose  = 0;

            OXs[0] = new OX()
            {
                OXPictureBox = null
            };
            OXs[1] = new OX()
            {
                OXPictureBox = null
            };
            Amr       = objFactory.getPunter("Amr", null, null);
            Amr.money = BettingAmount;
            Amr.PlaceBet((int)BettingAmount, OXNumber);

            bool nowin = true;
            int  win   = -1;

            while (nowin)
            {
                for (int i = 0; i < OXs.Length; i++)
                {
                    if (OX.Run(OXs[i]))
                    {
                        win = i + 1;
                        Amr.Collect(win);
                        nowin = false;
                    }
                }
            }
            if (Amr.gamble.OXNum == win)
            {
                Assert.AreEqual(expectedWin, Amr.money, "Account not credited correctly");
            }
            if (Amr.gamble.OXNum != win)
            {
                Assert.AreEqual(expectedLose, Amr.money, "Account not debited correctly");
            }
        }
示例#3
0
        public void TestWinnerOutcome()
        {
            Bull.StartingPosition1 = 0;
            Bull.RacetrackLength1  = 50;
            int BettingAmount = 50;
            int BullNumber    = 1;
            int expectedWin   = 100;
            int expectedLose  = 0;

            Bulls[0] = new Bull()
            {
                BullPictureBox = null
            };
            Bulls[1] = new Bull()
            {
                BullPictureBox = null
            };
            Hartej       = objFactory.getPunter("Hartej", null, null);
            Hartej.money = BettingAmount;
            Hartej.PlaceBet((int)BettingAmount, BullNumber);

            bool nowin = true;
            int  win   = -1;

            while (nowin)
            {
                for (int i = 0; i < Bulls.Length; i++)
                {
                    if (Bull.Run(Bulls[i]))
                    {
                        win = i + 1;
                        Hartej.Collect(win);
                        nowin = false;
                    }
                }
            }
            if (Hartej.gamble.BullNum == win)
            {
                Assert.AreEqual(expectedWin, Hartej.money, "Account not credited correctly");
            }
            if (Hartej.gamble.BullNum != win)
            {
                Assert.AreEqual(expectedLose, Hartej.money, "Account not debited correctly");
            }
        }
示例#4
0
        public void TestWinnerOutcome()
        {
            Kangaroo.StartingPosition1 = 0;
            Kangaroo.RacetrackLength1  = 50;
            int BettingAmount  = 45;
            int KangarooNumber = 1;
            int expectedWin    = 90;
            int expectedLose   = 0;

            Kangaroos[0] = new Kangaroo()
            {
                KangarooPictureBox = null
            };
            Kangaroos[1] = new Kangaroo()
            {
                KangarooPictureBox = null
            };
            Iqbal      = pFactory.getPunter("Iqbal", null, null);
            Iqbal.Cash = BettingAmount;
            Iqbal.PlaceBet((int)BettingAmount, KangarooNumber);

            bool nowin = true;
            int  win   = -1;

            while (nowin)
            {
                for (int i = 0; i < Kangaroos.Length; i++)
                {
                    if (Kangaroo.Run(Kangaroos[i]))
                    {
                        win = i + 1;
                        Iqbal.Collect(win);
                        nowin = false;
                    }
                }
            }
            if (Iqbal.bet.KangarooNum == win)
            {
                Assert.AreEqual(expectedWin, Iqbal.Cash, "Account not credited correctly");
            }
            if (Iqbal.bet.KangarooNum != win)
            {
                Assert.AreEqual(expectedLose, Iqbal.Cash, "Account not debited correctly");
            }
        }
示例#5
0
        public void TestWinnerOutcome()
        {
            Cycle.StartingPosition1 = 0;
            Cycle.RacetrackLength1  = 50;
            int BettingAmount = 50;
            int CycleNumber   = 1;
            int expectedWin   = 100;
            int expectedLose  = 0;

            Cycles[0] = new Cycle()
            {
                CyclePictureBox = null
            };
            Cycles[1] = new Cycle()
            {
                CyclePictureBox = null
            };
            Kaur       = PlayerFactory.getPunter("Kaur", null, null);
            Kaur.money = BettingAmount;
            Kaur.PlaceBet((int)BettingAmount, CycleNumber);

            bool nowin = true;
            int  win   = -1;

            while (nowin)
            {
                for (int i = 0; i < Cycles.Length; i++)
                {
                    if (Cycle.Run(Cycles[i]))
                    {
                        win = i + 1;
                        Kaur.Collect(win);
                        nowin = false;
                    }
                }
            }
            if (Kaur.gamble.CycleNum == win)
            {
                Assert.AreEqual(expectedWin, Kaur.money, "Account not credited correctly");
            }
            if (Kaur.gamble.CycleNum != win)
            {
                Assert.AreEqual(expectedLose, Kaur.money, "Account not debited correctly");
            }
        }