Esempio n. 1
0
        public void BotMakeBetTest()
        {
            Bot            justPlayer = new Bot(1);
            OneThreeTwoSix testBot    = new OneThreeTwoSix(1);
            Martingale     marty      = new Martingale(1);
            Oscar          oscar      = new Oscar(1);

            Bot[] botSet = new Bot[] { testBot, marty, oscar };
            for (int j = 0; j < 4; j++)
            {
                justPlayer.ChangeBank(-justPlayer.GiveResponce());
                justPlayer.ChangeBank(10000);
                justPlayer.MakeBet(j);
                if (justPlayer.GetBet(j) != 100 || justPlayer.GiveResponce() != 10000 - 100)
                {
                    Assert.Fail();
                }
                for (int k = 0; k < 5; k++)
                {
                    marty.ChangeBank(10000);
                    marty.LastBank   = marty.GiveResponce() + 1;
                    marty.LoseStreak = k;
                    marty.MakeBet(j);

                    testBot.ChangeBank(10000);
                    testBot.Step     = k;
                    testBot.LastBank = 0;
                    testBot.MakeBet(j);

                    oscar.Wins = k;
                    oscar.ChangeBank(10000);
                    oscar.LastBank = 10001;
                    oscar.MakeBet(j);

                    switch (k)
                    {
                    case 0:
                    {
                        if (marty.GiveResponce() != 9800 || marty.GetBet(j) != 200 ||
                            testBot.GetBet(j) != 50 || testBot.GiveResponce() != 9950 ||
                            oscar.GetBet(j) != 100 || oscar.GiveResponce() != 9900)
                        {
                            Assert.Fail();
                        }
                        break;
                    }

                    case 1:
                    {
                        if (marty.GiveResponce() != 9600 || marty.GetBet(j) != 400 ||
                            testBot.GiveResponce() != 9850 || testBot.GetBet(j) != 150 ||
                            oscar.GetBet(j) != 103 || oscar.GiveResponce() != 9897)
                        {
                            Assert.Fail();
                        }
                        break;
                    }

                    case 2:
                    {
                        if (marty.GiveResponce() != 9200 || marty.GetBet(j) != 800 ||
                            testBot.GetBet(j) != 100 || testBot.GiveResponce() != 9900 ||
                            oscar.GetBet(j) != 106 || oscar.GiveResponce() != 9894)
                        {
                            Assert.Fail();
                        }
                        break;
                    }

                    case 3:
                    {
                        if (marty.GiveResponce() != 8400 || marty.GetBet(j) != 1600 ||
                            testBot.GiveResponce() != 9700 | testBot.GetBet(j) != 300 ||
                            oscar.GetBet(j) != 109 || oscar.GiveResponce() != 9891)
                        {
                            Assert.Fail();
                        }
                        break;
                    }

                    case 4:
                    {
                        if (marty.GiveResponce() != 6800 || marty.GetBet(j) != 3200 ||
                            testBot.Step != 0 || testBot.GetBet(j) != 50 || testBot.GiveResponce() != 9950 ||
                            oscar.GetBet(j) != 112 || oscar.GiveResponce() != 9888)
                        {
                            Assert.Fail();
                        }
                        break;
                    }

                    default:
                    {
                        if (marty.GiveResponce() != 3600 | marty.GetBet(j) != 6400)
                        {
                            Assert.Fail();
                        }
                        break;
                    }
                    }
                    marty.ChangeBank(-marty.GiveResponce());
                    testBot.ChangeBank(-testBot.GiveResponce());
                    oscar.ChangeBank(-oscar.GiveResponce());
                }
            }
            Assert.Pass();
        }