Exemplo n.º 1
0
        public void UnityIoCContainerTest()
        {
            Console.WriteLine("“I know only 2 ways to beat roulette: steal chips from the table\n" +
                              "or open your own casino and put roulette there,” - Albert Einstein.\nNow we will check these words:\n");

            int gamesMustPlay = 42;

            IUnityContainer rouletteContainer = InitializeRouletteIoCContainer();

            Table         table  = rouletteContainer.Resolve <Table>();
            MartingaleBot martin = rouletteContainer.Resolve <MartingaleBot>("MartingaleBot");
            TitanicBot    titan  = rouletteContainer.Resolve <TitanicBot>("TitanicBot");
            BeginnerBot   begin  = rouletteContainer.Resolve <BeginnerBot>("BeginnerBot");

            Console.WriteLine();

            for (int i = 0; i < gamesMustPlay; i++)
            {
                table.SpinRoulette();

                martin.MakeBet();
                titan.MakeBet();
                begin.MakeBet();

                martin.DisplayInformation(gamesMustPlay);
                titan.DisplayInformation(gamesMustPlay);
                begin.DisplayInformation(gamesMustPlay);
            }

            Console.WriteLine($"\nThe cash balance of the table is {table.cashBalance}$.");
        }
Exemplo n.º 2
0
        public void RouletteTest()
        {
            Console.WriteLine("“I know only 2 ways to beat roulette: steal chips from the tableA\n" +
                              "or open your own casino and put roulette there,” - Albert Einstein.\nNow we will check these words:\n");

            int gamesMustPlay = 42;

            Table tableA = new Table();

            MartingaleBot martin = new MartingaleBot(tableA);
            TitanicBot    titan  = new TitanicBot(tableA);
            BeginnerBot   begin  = new BeginnerBot(tableA);

            Console.WriteLine();

            for (int i = 0; i < gamesMustPlay; i++)
            {
                tableA.SpinRoulette();

                martin.MakeBet();
                titan.MakeBet();
                begin.MakeBet();

                martin.DisplayInformation(gamesMustPlay);
                titan.DisplayInformation(gamesMustPlay);
                begin.DisplayInformation(gamesMustPlay);
            }

            Console.WriteLine($"\nThe cash balance of the tableA is {tableA.CashBalance}$.\n\n");

            Table tableB = new Table();

            MartingaleBot martinB = new MartingaleBot(tableB);
            TitanicBot    titanB  = new TitanicBot(tableB);
            BeginnerBot   beginB  = new BeginnerBot(tableB);

            Console.WriteLine();

            for (int i = 0; i < gamesMustPlay; i++)
            {
                tableB.SpinRoulette();

                martinB.MakeBet();
                titanB.MakeBet();
                beginB.MakeBet();

                martinB.DisplayInformation(gamesMustPlay);
                titanB.DisplayInformation(gamesMustPlay);
                beginB.DisplayInformation(gamesMustPlay);
            }

            Console.WriteLine($"\nThe cash balance of the tableB is {tableB.CashBalance}$.");
        }