Exemplo n.º 1
0
        public void Setup()
        {
            testController = new PokerDemoController(
                () => { return(new Card()); },
                () => { return(new PokerHand()); },
                new PokerHandJudge(() => { return(new PokerHandVerdict()); }),
                () => { return(new PokerEvaluationViewModel()); });

            NameValueCollection testFormData = new NameValueCollection();

            for (int playerBeingAdded = 1; playerBeingAdded <= 2; playerBeingAdded++)
            {
                testFormData.Add(
                    String.Format("player-{0}-name", playerBeingAdded.ToString()),
                    String.Format("Player {0}", playerBeingAdded.ToString()));

                for (int cardBeingAdded = 1; cardBeingAdded <= 5; cardBeingAdded++)
                {
                    testFormData.Add(
                        String.Format(
                            "rank-player-{0}-card-{1}",
                            playerBeingAdded.ToString(),
                            cardBeingAdded.ToString()),
                        Enum.GetValues(typeof(CardRank)).GetValue(cardBeingAdded).ToString());
                    testFormData.Add(
                        String.Format(
                            "suit-player-{0}-card-{1}",
                            playerBeingAdded.ToString(),
                            cardBeingAdded.ToString()),
                        cardBeingAdded == 1 ? CardSuit.Clubs.ToString() : CardSuit.Diamonds.ToString());
                }
            }
            testForm = new FormCollection(testFormData);

            argumentNullChecker = new ArgumentNullExceptionChecker();
            shucker             = new ActionResultShucker();
        }
        public void Setup()
        {
            testController = new PokerDemoController(
                () => { return new Card(); },
                () => { return new PokerHand(); },
                new PokerHandJudge(() => { return new PokerHandVerdict(); }),
                () => { return new PokerEvaluationViewModel(); });

            NameValueCollection testFormData = new NameValueCollection();
            for(int playerBeingAdded = 1; playerBeingAdded <= 2; playerBeingAdded++)
            {
                testFormData.Add(
                    String.Format("player-{0}-name", playerBeingAdded.ToString()),
                    String.Format("Player {0}", playerBeingAdded.ToString()));

                for(int cardBeingAdded = 1; cardBeingAdded <= 5; cardBeingAdded++)
                {
                    testFormData.Add(
                        String.Format(
                            "rank-player-{0}-card-{1}",
                            playerBeingAdded.ToString(),
                            cardBeingAdded.ToString()),
                        Enum.GetValues(typeof(CardRank)).GetValue(cardBeingAdded).ToString());
                    testFormData.Add(
                        String.Format(
                            "suit-player-{0}-card-{1}",
                            playerBeingAdded.ToString(),
                            cardBeingAdded.ToString()),
                            cardBeingAdded == 1 ? CardSuit.Clubs.ToString() : CardSuit.Diamonds.ToString());
                }
            }
            testForm = new FormCollection(testFormData);

            argumentNullChecker = new ArgumentNullExceptionChecker();
            shucker = new ActionResultShucker();
        }