Beispiel #1
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());
        }
Beispiel #2
0
        public static void BringCardFromDeckToField(ref Game game, Card card)
        {
            DeckHelpers.RemoveCardFromDeck(ref game, card);
            List <Card> theField = game.Field;

            theField.Add(card);
            typeof(Game).GetProperty("Field").SetValue(game, theField);
        }
Beispiel #3
0
        public static void BringCardFromDeckToDiscardPile(ref Game game, Card card)
        {
            DeckHelpers.RemoveCardFromDeck(ref game, card);
            DiscardPile discardPile             = game.DiscardPile;
            FieldInfo   cardsinDiscardFieldInfo = typeof(DiscardPile).GetField("Cards",
                                                                               BindingFlags.NonPublic | BindingFlags.Instance);
            List <Card> cardsInDiscard = cardsinDiscardFieldInfo.GetValue(discardPile) as List <Card>;

            cardsInDiscard.Add(card);
            cardsinDiscardFieldInfo.SetValue(discardPile, cardsInDiscard);
            typeof(Game).GetProperty("DiscardPile").SetValue(game, discardPile);
        }
Beispiel #4
0
        public static void BringCardFromDeckToScoreZone(ref Game game, Card card, int scoreZoneIndex)
        {
            DeckHelpers.RemoveCardFromDeck(ref game, card);
            var shit = typeof(ScoreZone).GetMethod("AddCard",
                                                   BindingFlags.NonPublic | BindingFlags.Instance);

            ScoreZone[] zonearray    = game.ScoreZones;
            ScoreZone   zoneToModify = game.ScoreZones[scoreZoneIndex];

            shit.Invoke(zoneToModify, new object[] { card });
            zonearray[scoreZoneIndex] = zoneToModify;
            typeof(Game).GetProperty("ScoreZones").SetValue(game, zonearray);
        }
Beispiel #5
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());
        }
Beispiel #6
0
 public static void BringCardToPositionInDeck(ref Game game, Card card, int position)
 {
     DeckHelpers.BringCardToPosition(ref game, card, position);
 }