Exemple #1
0
        public void ArgumentExceptionIsThrown_WhenBettingScoreIsGreaterThanTwelveInTwoDiceGame()
        {
            var casino       = new Casino();
            var game         = casino.CreateGame(new Die(), 2);
            var player       = Create.Player.InCasino(casino).InGame(game).WithChips(100).Please();
            var invalidScore = 13;

            Assert.ThrowsException <ArgumentException>(() => player.MakeBetOn(1, invalidScore));
        }
Exemple #2
0
        public void ChipsCountUnchanged_WhenLostTheGame()
        {
            var casino           = new Casino();
            var die              = Create.Die.Rolling(1).Please();
            var game             = casino.CreateGame(die);
            int chipsAmount      = 100;
            var player           = Create.Player.InCasino(casino).InGame(game).WithChips(chipsAmount).Betting(chipsAmount).On(2).Please();
            var formerChipsCount = player.Chips;

            game.Run();

            Assert.AreEqual(formerChipsCount, player.Chips);
        }
Exemple #3
0
        public void ChipsCountIncreasedBySixTimesBetAmount_WhenWonTheGame()
        {
            var casino           = new Casino();
            var winningScore     = 1;
            var die              = Create.Die.Rolling(winningScore).Please();
            var game             = casino.CreateGame(die);
            int chipsAmount      = 100;
            var player           = Create.Player.InCasino(casino).InGame(game).WithChips(chipsAmount).Betting(chipsAmount).On(winningScore).Please();
            var formerChipsCount = player.Chips;

            game.Run();

            Assert.AreEqual(formerChipsCount + chipsAmount * 6, player.Chips);
        }
Exemple #4
0
        public void ChipsCountIncreasedBySixTimesWinningBetAmount_WhenOneOfTheBetsWonTheGame()
        {
            var casino        = new Casino();
            var winningScore  = 1;
            var die           = Create.Die.Rolling(winningScore).Please();
            var game          = casino.CreateGame(die);
            var winningAmount = 7;
            var player        =
                Create.Player
                .InCasino(casino).InGame(game)
                .WithChips(100)
                .Betting(winningAmount).On(winningScore)
                .Betting(11).On(2)
                .Betting(13).On(3)
                .Please();
            var formerChipsCount = player.Chips;

            game.Run();

            Assert.AreEqual(formerChipsCount + winningAmount * 6, player.Chips);
        }
Exemple #5
0
 public Game CreateTwoDiceGame(Casino casino)
 {
     return(casino.CreateGame(new Die(), 2));
 }