예제 #1
0
        private static GameSettings SetGameSetting(string input)
        {
            GameSettings setting = new GameSettings();

            if (input.Trim().ToUpper().Equals("Y"))
            {
                Console.WriteLine();

                Console.WriteLine("Please select one of above: " +
                                  "\n1. Enter number of decks" +
                                  "\n2. Select a set of decks");
                input = Console.ReadLine().Trim().ToUpper();

                while (input != "1" && input != "2")
                {
                    Console.WriteLine("Invalid entry please try again (1-2):");
                    input = Console.ReadLine().Trim().ToUpper();
                }

                Console.WriteLine();

                switch (input)
                {
                case "1":
                    Console.WriteLine("How many decks will be playing? (1-10):");
                    input = Console.ReadLine();

                    while (!ValidateGameRules.ValidateNumberOfDecks(input))
                    {
                        Console.WriteLine("Invalid number of decks try again please (1-10): ");
                        input = Console.ReadLine();
                    }
                    setting = ValidateGameRules.GetSettingSetOfDecks(int.Parse(input), 0, 0);
                    break;

                case "2":
                    Console.WriteLine("Please select one of above: " +
                                      "\n1. Eight standard decks (416 cards)" +
                                      "\n2. Two standard decks with 2's through 6's removed (64 cards)" +
                                      "\n3. Standard deck with the 2's through 5's removed (36 cards)" +
                                      "\n4. Standard deck with the 2's through 8's removed (24 cards)" +
                                      "\n5. Eight standard decks with the 8's, 9's, and 10's removed (320 cards)" +
                                      "\n6. Two standard decks with 2's through 8's removed (48 cards)");
                    input = Console.ReadLine().Trim().ToUpper();

                    while (!ValidateGameRules.ValidateSettingSetOfDecks(input))
                    {
                        Console.WriteLine("Invalid set of decks try again please (1-6): ");
                        input = Console.ReadLine();
                    }

                    setting = ValidateGameRules.GetSettingSetOfDecks(int.Parse(input));
                    break;
                }

                Console.WriteLine();
            }

            return(setting);
        }
예제 #2
0
        public void A_Game_Is_Initialize_With_First_Customize_Set_Of_Deck()
        {
            GameSettings setting = ValidateGameRules.GetSettingSetOfDecks(1);

            var newPlayer = new Game(setting);

            newPlayer.BeginGame();

            Assert.IsTrue(newPlayer.SetOfDecks.Count == 416);
        }
예제 #3
0
        public void A_Game_Is_Initialize_With_Second_Customize_Set_Of_Deck()
        {
            GameSettings setting = ValidateGameRules.GetSettingSetOfDecks(2);

            var newPlayer = new Game(setting);

            newPlayer.BeginGame();

            Assert.IsTrue(newPlayer.SetOfDecks.Count == 64);
            foreach (var card in setting.ExcludeCards)
            {
                Assert.IsFalse(newPlayer.SetOfDecks.Contains(card));
            }
        }