Example #1
0
        static void Main(string[] args)
        {
            RouletteGame.Output.ConsoleOutput output = new RouletteGame.Output.ConsoleOutput();

            RouletteGame.Fields.IFieldFactory    fieldFactory = new StandardFieldFactory();
            RouletteGame.Randomizing.IRandomizer randomizer   = new RouletteRandomizer();

            RouletteGame.Roulette.IRoulette roulette = new RouletteGame.Roulette.Roulette(fieldFactory, randomizer);

            RouletteGame.Game.Game game = new RouletteGame.Game.Game(roulette, output);

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

            game.PlaceBet(new EvenOddBet("Player 2", 100, Parity.Even));
            game.PlaceBet(new EvenOddBet("Player 2", 100, Parity.Odd));

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

            game.CloseBets();
            game.SpinRoulette();
            game.PayUp();
        }
        public void FieldFactory_CreateFields_FieldColorsAreCorrect(int fieldNumber, FieldColor color)
        {
            var list  = new StandardFieldFactory().CreateFields();
            var index = list.FindIndex(field => field.Number == fieldNumber);

            Assert.That(list[index].Color, Is.EqualTo(color));
        }
        public void Setup()
        {
            _fakeOutput     = Substitute.For <IOutput>();
            _fakeRandomizer = Substitute.For <IRandomizer>();

            _fieldFactory = new StandardFieldFactory();
            _roulette     = new Roulette.Roulette(_fieldFactory, _fakeRandomizer);

            _rouletteGame = new Game.Game(_roulette, _fakeOutput);

            _fieldBet   = new FieldBet("Bente", 100, 2);
            _colorBet   = new ColorBet("Bjarne", 100, FieldColor.Black);
            _evenOddBet = new EvenOddBet("Berit", 100, Parity.Even);
        }
        public void FieldFactory_CreateFields_CountOK()
        {
            var uut = new StandardFieldFactory();

            Assert.That(uut.CreateFields().Count, Is.EqualTo(37));
        }