Example #1
0
        public static ICollection <IDevelopmentCard> GenerateDevelopmentCards()
        {
            int[] developmentCardsTypesCount    = new int[] { NumberOfKnightCard, NumberOfVictoryPointCard, NumberOfRoadBuildCard, NumberOfResourceGetCard };
            IDevelopmentCard[] developmentCards = new IDevelopmentCard[CommonConstants.DevelopmentCardsNumber];
            Random             rand             = new Random();

            for (int i = 0; i < CommonConstants.DevelopmentCardsNumber; i++)
            {
                int cardType = rand.Next(developmentCardsTypesCount.Length);
                while (developmentCardsTypesCount[cardType] <= 0)
                {
                    cardType = (cardType + 1) % developmentCardsTypesCount.Length;
                }
                developmentCardsTypesCount[cardType]--;
                IDevelopmentCard card = null;
                switch (cardType)
                {
                case 0: card = new KnightCard(); break;

                case 1: card = new VictoryPointCard(); break;

                case 2: card = new RoadBuildCard(); break;

                case 3: card = new ResourceGetCard(); break;

                default: throw new ArgumentOutOfRangeException("Such development card type does not exist");
                }
                developmentCards[i] = card;
            }
            return(developmentCards);
        }
Example #2
0
        public void TestKnightWinsAgainstOtherThenWaterSpells_ShouldBeFalse(Element element)
        {
            var spell = new SpellCard()
            {
                Element = element,
            };
            var knight = new KnightCard();

            knight.WinsAgainst(spell).Should().BeFalse();
        }
Example #3
0
        public void TestWaterSpellWinsAgainstKnight_ShouldBeTrue()
        {
            var spell = new SpellCard()
            {
                Element = Element.Water,
            };
            var knight = new KnightCard();

            spell.WinsAgainst(knight).Should().BeTrue();
        }
Example #4
0
        public void TestKnightWinsAgainstWaterSpell_ShouldBeFalse()
        {
            var spell = new SpellCard()
            {
                Element = Element.Water,
            };
            var knight = new KnightCard();

            knight.WinsAgainst(spell).Should().BeFalse();
        }