Exemple #1
0
        public void TakeAllActionTakesCardsAndSwitchesTurns()
        {
            Game gameFixture = new Game();

            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.TakeAll, Actions.Draw
            });
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfKeys);

            gameFixture.TakeAction(Actions.TakeAll);

            gameFixture.Field.Count.Should().Be(0);
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Keys).Value.Should().Be(5);
            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions> {
                Actions.Draw
            },
                options => options.WithoutStrictOrdering());
            gameFixture.CurrentPlayersTurn.Should().Be(Players.PlayerTwo);
        }
Exemple #2
0
        public void DrawActionDrawsACard()
        {
            Game gameFixture = new Game();

            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.Draw
            });
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            DeckHelpers.BringCardToPosition(ref gameFixture, FiveOfKeys, 0);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.Deck.RemainingCards.Should().Be(49);
            gameFixture.Field.Count.Should().Be(1);
            gameFixture.Field[0].Should().Be(FiveOfKeys);
            gameFixture.CurrentPlayersTurn.Should().Be(Players.PlayerOne);
            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions> {
                Actions.Draw, Actions.TakeAll
            },
                options => options.WithoutStrictOrdering());
        }
Exemple #3
0
        public void GameEndsWhenLastCardsAreTaken()
        {
            Game gameFixture = new Game();

            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.TakeAll
            });
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfKeys);
            GameHelpers.MoveEntireDeckToDiscardPile(ref gameFixture);

            gameFixture.TakeAction(Actions.TakeAll);

            gameFixture.IsGameOver.Should().Be(true);
        }
Exemple #4
0
        public void DrawingIntoABustDiscardsTheFieldAndSwitchesTurns()
        {
            Game gameFixture = new Game();

            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.Draw
            });
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };
            Card SevenOfKeys = new Card {
                Suit = Suites.Keys, Value = 7
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfKeys);
            DeckHelpers.BringCardToPosition(ref gameFixture, SevenOfKeys, 0);
            GameHelpers.ClearDiscardPile(ref gameFixture);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.Field.Count.Should().Be(0);
            gameFixture.CurrentPlayersTurn.Should().Be(Players.PlayerTwo);
            gameFixture.ScoreZones[0].PointsShowing().Should().Be(0);
            gameFixture.DiscardPile.Count.Should().Be(2);

            List <Card> discardPileCards = typeof(DiscardPile).GetField("Cards",
                                                                        BindingFlags.NonPublic | BindingFlags.Instance)
                                           .GetValue(gameFixture.DiscardPile) as List <Card>;

            discardPileCards.Should().BeEquivalentTo(
                new List <Card> {
                FiveOfKeys, SevenOfKeys
            },
                options => options.WithoutStrictOrdering());
        }