Пример #1
0
        private CardCollection BuildNineThroughAceOfEachSuit()
        {
            var nineThroughAces = new List <IRank>
            {
                _rankFactory.GetRank(RankEnum.Ace),
                _rankFactory.GetRank(RankEnum.King),
                _rankFactory.GetRank(RankEnum.Queen),
                _rankFactory.GetRank(RankEnum.Jack),
                _rankFactory.GetRank(RankEnum.Ten),
                _rankFactory.GetRank(RankEnum.Nine),
            };

            var suits = new List <ISuit>
            {
                _suitFactory.GetSuit(SuitEnum.Diamonds),
                _suitFactory.GetSuit(SuitEnum.Clubs),
                _suitFactory.GetSuit(SuitEnum.Hearts),
                _suitFactory.GetSuit(SuitEnum.Spades),
            };

            var cardCollection = new CardCollection();

            foreach (var suit in suits)
            {
                foreach (var rank in nineThroughAces)
                {
                    cardCollection.Add(new Card(rank, suit));
                }
            }

            return(cardCollection);
        }
        private static ISuit FromFactory(SuitEnum suit)
        {
            var factory = new SuitFactory();

            return(factory.GetSuit(suit));
        }