public void SuccessPlayTest()
        {
            var bet = new DozenBet(250, _testBot, 1);

            bet.Play(new Field(13, Color.Red));

            Assert.AreEqual(1750, _testBot.Money);

            Assert.Pass();
        }
        public void FailPlayTest()
        {
            var bet = new DozenBet(250, _testBot, 2);

            bet.Play(new Field(13, Color.Green));

            Assert.AreEqual(1000, _testBot.Money);

            Assert.Pass();
        }
Ejemplo n.º 3
0
        private static void DozenBet(Player player, ref Bet bet)
        {
            System.Console.WriteLine("Enter which number of dozen to bet on:");
            System.Console.WriteLine("[1] First");
            System.Console.WriteLine("[2] Second");
            System.Console.WriteLine("[3] Third");
            var value = System.Console.ReadLine();

            if (int.TryParse(value, out var valueInt) && Enum.IsDefined(typeof(Column), valueInt))
            {
                var column = (Column)Enum.ToObject(typeof(Column), valueInt);
                bet = new DozenBet(player, column);
            }
            else
            {
                _error = "Invalid dozen, please try [1], [2] or [3]!";
            }
        }
        public void InitializeBetTest()
        {
            Cell cellOne = new Cell(1, ColourEnum.Black, ParityEnum.Odd, DozenEnum.DozenTwo);
            Cell cellTwo = new Cell(23, ColourEnum.Red, ParityEnum.Even, DozenEnum.DozenThree);

            ColourBet betOne = new ColourBet(1, 1000, ColourEnum.Red);

            Assert.AreEqual(betOne.Player, 1);
            Assert.AreEqual(betOne.Money, 1000);
            Assert.AreEqual(betOne.BetCell, ColourEnum.Red);
            Assert.AreEqual(betOne.CheckBet(cellOne), 0);
            Assert.AreEqual(betOne.CheckBet(cellTwo), 2);

            DozenBet betTwo = new DozenBet(1241411, 132420, DozenEnum.DozenThree);

            Assert.AreEqual(betTwo.Player, 1241411);
            Assert.AreEqual(betTwo.Money, 132420);
            Assert.AreEqual(betTwo.BetCell, DozenEnum.DozenThree);
            Assert.AreEqual(betTwo.CheckBet(cellOne), 0);
            Assert.AreEqual(betTwo.CheckBet(cellTwo), 3);

            ParityBet betThree = new ParityBet(0, 12, ParityEnum.Even);

            Assert.AreEqual(betThree.Player, 0);
            Assert.AreEqual(betThree.Money, 12);
            Assert.AreEqual(betThree.BetCell, ParityEnum.Even);
            Assert.AreEqual(betThree.CheckBet(cellOne), 0);
            Assert.AreEqual(betThree.CheckBet(cellTwo), 2);

            NumberBet betFour = new NumberBet(2, 1200000, 23);

            Assert.AreEqual(betFour.Player, 2);
            Assert.AreEqual(betFour.Money, 1200000);
            Assert.AreEqual(betFour.BetCell, 23);
            Assert.AreEqual(betFour.CheckBet(cellOne), 0);
            Assert.AreEqual(betFour.CheckBet(cellTwo), 36);

            Assert.Throws <System.ArgumentOutOfRangeException>(() => new NumberBet(34, 123456, 46));
        }
        public void CreateTest()
        {
            var bet = new DozenBet(250, _testBot, 0);

            Assert.Pass();
        }