Beispiel #1
0
        public void ShouldDraw_DifferentCards_WhenCalledAgain()
        {
            //assign
            IRandom fakeRandom = new FakeRandom();

            List <ICard> startingDeck = new List <ICard>
            {
                new RedCard(), new GreenCard(), new BlueCard(),
                new RedCard(), new BlueCard(), new RedCard(), new GreenCard()
            };
            List <ICard> firstExpected = new List <ICard>
            {
                new RedCard(), new GreenCard(), new BlueCard(),
            };
            List <ICard> secondExpected = new List <ICard>
            {
                new RedCard(), new BlueCard(),
            };

            CardList cardList    = new CardList(startingDeck);
            IDeck    currentDeck = new DummyDeck(fakeRandom, cardList);
            //act
            List <ICard> firstDraw  = currentDeck.Draw(3);
            List <ICard> secondDraw = currentDeck.Draw(2);

            //assert
            firstExpected.ForEach(card => firstDraw.Should().ContainSingle(actualCard => actualCard.Matches(card)));
            secondExpected.ForEach(card => secondDraw.Should().ContainSingle(actualCard => actualCard.Matches(card)));
        }
Beispiel #2
0
        public void ShouldNotEquate()
        {
            IRandom fakeRandom = new FakeRandom();
            //assign
            List <ICard> startingDeck1 = new List <ICard>
            {
                new RedCard(), new GreenCard(), new BlueCard(),
                new RedCard(), new GreenCard(), new BlueCard(),
                new RedCard(), new GreenCard(), new BlueCard()
            };

            List <ICard> startingDeck2 = new List <ICard>
            {
                new RedCard(), new GreenCard(), new BlueCard(),
                new RedCard(), new GreenCard(), new BlueCard(),
                new GreenCard(), new RedCard(), new BlueCard()
            };

            CardList  cardList1 = new CardList(startingDeck1);
            CardList  cardList2 = new CardList(startingDeck2);
            DummyDeck deck1     = new DummyDeck(fakeRandom, cardList1);
            DummyDeck deck2     = new DummyDeck(fakeRandom, cardList2);

            //assert
            deck1.Should().NotBe(deck2);
        }
Beispiel #3
0
        public void ShouldHave_0_StartingCrystals()
        {
            //assign
            IDeck        startingDummyDeck = new DummyDeck();
            IDummyPlayer dummyPlayer       = new DummyPlayer(startingDummyDeck);
            //act
            int startingCrystalCount = dummyPlayer.CrystalCount();

            //assert
            startingCrystalCount.Should().Be(0);
        }
Beispiel #4
0
        public void ShouldHave_1_StartingCrystal()
        {
            //assign
            IEnumerable <ICrystal> crystals = new List <ICrystal> {
                new GreenCrystal()
            };
            IDeck        startingDummyDeck = new DummyDeck();
            IDummyPlayer dummyPlayer       = new DummyPlayer(startingDummyDeck, crystals);
            //act
            int startingCrystalCount = dummyPlayer.CrystalCount();

            //assert
            startingCrystalCount.Should().Be(1);
        }
Beispiel #5
0
        public void ShouldShuffleCards()
        {
            //assign
            IRandom fakeRandom = new FakeRandom();

            List <ICard> startingDeck = new List <ICard>
            {
                new RedCard(), new GreenCard(), new BlueCard(),
                new RedCard(), new BlueCard(), new RedCard(), new GreenCard()
            };
            CardList cardList    = new CardList(startingDeck);
            IDeck    currentDeck = new DummyDeck(fakeRandom, cardList);
            //act
            List <ICard> firstDrawCards = currentDeck.Draw(7);

            //assert
            firstDrawCards.Should().ContainInOrder(startingDeck);

            IDeck shuffledDeck = currentDeck.Shuffle();

            shuffledDeck.Should().NotBe(startingDeck);
        }
Beispiel #6
0
        public void ShouldDraw_Cards_WhenLessThanRequestedAmountExists()
        {
            //assign
            IRandom fakeRandom = new FakeRandom();

            List <ICard> startingDeck = new List <ICard>
            {
                new RedCard(), new GreenCard()
            };
            List <ICard> expectedReturn = new List <ICard>
            {
                new RedCard(), new GreenCard()
            };

            CardList cardList    = new CardList(startingDeck);
            IDeck    currentDeck = new DummyDeck(fakeRandom, cardList);
            //act
            List <ICard> drawnCards = currentDeck.Draw(5);

            //assert
            expectedReturn.ForEach(card => drawnCards.Should().ContainSingle(actualCard => actualCard.Matches(card)));
        }