Exemplo n.º 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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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());
        }