Esempio n. 1
0
        public void RouletteGame_PayUp_Test()
        {
            // Setting up Substitudes
            var _fakeRoulette = Substitute.For <IRoulette>();
            var _fakeField    = Substitute.For <Field>(10u, Field.Black);
            var _bet          = Substitute.For <FieldBet>("SubBet", 20u, 10u);

            // Setting up Sub returnCalls
            _bet.WonAmount(_fakeField).Returns(50u);
            _fakeRoulette.GetResult().Returns(_fakeField);

            var uut = new RouletteGame.Legacy.RouletteGame(_fakeRoulette);

            uut.OpenBets();

            uut.PlaceBet(_bet);

            uut.CloseBets();

            uut.PayUp();

            _bet.Received(1).WonAmount(_fakeField);

            _fakeRoulette.Received(1).GetResult();
        }
Esempio n. 2
0
        public void RouletteFakeBetPlayerName()
        {
            var roulette = new Roulette(new Randomizer());
            var uut      = new RouletteGame.Legacy.RouletteGame(roulette);
            var fakeBet  = new FakeBet("FakeBet", 100);

            Assert.That(fakeBet.PlayerName, Is.EqualTo("FakeBet"));
        }
Esempio n. 3
0
        public void RouletteFakeBetAmount()
        {
            var roulette = new Roulette(new Randomizer());
            var uut      = new RouletteGame.Legacy.RouletteGame(roulette);
            var fakeBet  = new FakeBet("FakeBet", 100);

            Assert.That(fakeBet.Amount, Is.EqualTo(100));
        }
Esempio n. 4
0
        public void RouletteGame_Check_Getresult()
        {
            var _fakeRoulette = Substitute.For <IRoulette>();
            var uut           = new RouletteGame.Legacy.RouletteGame(_fakeRoulette);

            uut.SpinRoulette();

            _fakeRoulette.Received(1).GetResult();
        }
Esempio n. 5
0
        public void RouletteCloseBet()
        {
            var roulette = new FakeRoulette();
            var uut      = new RouletteGame.Legacy.RouletteGame(roulette);

            uut.CloseBets();

            Assert.That(uut.RoundIsOpen, Is.EqualTo(false));
        }
Esempio n. 6
0
        public void RoulettePayUp_TestRouletteGetResult()
        {
            var roulette = new FakeRoulette();
            var uut      = new RouletteGame.Legacy.RouletteGame(roulette);

            uut.PayUp();

            Assert.That(roulette.GetResultFuntionWasCalled, Is.EqualTo(true));
        }
Esempio n. 7
0
        public void RouletteSpin()
        {
            var roulette = new FakeRoulette();
            var uut      = new RouletteGame.Legacy.RouletteGame(roulette);

            uut.SpinRoulette();

            Assert.That(roulette.SpinFuntionWasCalled, Is.EqualTo(true));
        }
Esempio n. 8
0
        public void TestFakeSpin()
        {
            var RL = new FakeRoulette();

            RouletteGame.Legacy.RouletteGame RG = new RouletteGame.Legacy.RouletteGame(RL);
            RG.OpenBets();
            RG.PlaceBet(new ColorBet("player 1", 100, Field.Black));
            RG.CloseBets();
            RG.SpinRoulette();
            Assert.AreEqual(1, RL.CountGetResult);
        }
Esempio n. 9
0
        public void RouletteGame_Place_Bet_Closed_Bet_Expect_Exception()
        {
            var uut = new RouletteGame.Legacy.RouletteGame(Substitute.For <IRoulette>());

            uut.OpenBets();
            uut.CloseBets();

            Assert.Throws <RouletteGameException>(
                () => uut.PlaceBet(new EvenOddBet("hello", 5, true))
                );
        }
Esempio n. 10
0
        public void RoulettePayUp_TestBetWonAmount()
        {
            var roulette = new Roulette(new Randomizer());
            var uut      = new RouletteGame.Legacy.RouletteGame(roulette);
            var fakeBet  = new FakeBet("FakeBet", 100);

            uut.OpenBets();
            uut.PlaceBet(fakeBet);
            uut.PayUp();

            Assert.That(fakeBet.WonAmountWasCalled, Is.EqualTo(true));
        }
Esempio n. 11
0
        public void CanBlackWin()
        {
            Field field = new Field(1, 1);
            var   game  = new RouletteGame.Legacy.RouletteGame(new FakeRoulette(field));

            game.OpenBets();
            Bet bet = new ColorBet("Fake Player", 100, 1);

            game.PlaceBet(bet);
            game.CloseBets();
            game.SpinRoulette();
            game.PayUp();
            Assert.That(game.FakePayUp(bet).Equals(bet.WonAmount(field)));
        }
Esempio n. 12
0
 public void CanAllFieldWin()
 {
     for (uint i = 0; i < 37; i++)
     {
         Field field = new Field(i, 0);
         var   game  = new RouletteGame.Legacy.RouletteGame(new FakeRoulette(field));
         game.OpenBets();
         Bet bet = new FieldBet("Fake Player", 100, i);
         game.PlaceBet(bet);
         game.CloseBets();
         game.SpinRoulette();
         game.PayUp();
         Assert.That(game.FakePayUp(bet).Equals(bet.WonAmount(field)));
     }
 }
Esempio n. 13
0
        static void Main(string[] args)
        {
            var game = new RouletteGame(new Roulette(new Randomzier(), new FieldFactory()));

            game.OpenBets();
            game.PlaceBet(new ColorBet("Player 1", 100, Field.Black));
            game.PlaceBet(new ColorBet("Player 1", 100, Field.Red));

            game.PlaceBet(new EvenOddBet("Player 2", 100, true));
            game.PlaceBet(new EvenOddBet("Player 2", 100, false));

            for (uint i = 0; i < 36; i++)
            {
                game.PlaceBet(new FieldBet("Player 3", 100, i));
            }

            game.CloseBets();
            game.SpinRoulette();
            game.PayUp();
        }
        private static void Main()
        {
            var game = new RouletteGame(new Roulette());

            game.OpenBets();
            game.PlaceBet(new ColorBet("Player 1", 100, Field.Black));
            game.PlaceBet(new ColorBet("Player 1", 100, Field.Red));


            game.PlaceBet(new EvenOddBet("Player 2", 100, true));
            game.PlaceBet(new EvenOddBet("Player 2", 100, false));

            for (uint i = 0; i < 36; i++)
            {
                game.PlaceBet(new FieldBet("Player 3", 100, i));
            }

            game.CloseBets();
            game.SpinRoulette();
            game.PayUp();
        }