コード例 #1
0
ファイル: GameTests.cs プロジェクト: KevinUre/Boardgame-AIs
        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);
        }
コード例 #2
0
ファイル: GameTests.cs プロジェクト: KevinUre/Boardgame-AIs
        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);
        }
コード例 #3
0
ファイル: GameTests.cs プロジェクト: KevinUre/Boardgame-AIs
        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());
        }