예제 #1
0
        public void ChoosingATargetBringsThatCardIntoTheField()
        {
            Game gameFixture = new Game();
            Card FiveOfHooks = new Card()
            {
                Suit = Suites.Hooks, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfHooks);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, FiveOfKeys, 0);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseHookTarget
            });

            gameFixture.TakeAction(Actions.ChooseHookTarget, FiveOfKeys);

            gameFixture.Field.Count.Should().Be(2);
            gameFixture.Field[1].Should().BeEquivalentTo(FiveOfKeys);
            gameFixture.ScoreZones[0].PointsShowing().Should().Be(0);
            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.Draw, Actions.TakeAll
            },
                options => options.WithoutStrictOrdering());
        }
예제 #2
0
        public void ChoosingATargetWithAnEffectTriggersThatEffect()
        {
            Game gameFixture = new Game();
            Card FiveOfHooks = new Card()
            {
                Suit = Suites.Hooks, Value = 5
            };
            Card FiveOfCannons = new Card {
                Suit = Suites.Cannons, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfHooks);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, FiveOfCannons, 0);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, FiveOfKeys, 1);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseHookTarget
            });

            gameFixture.TakeAction(Actions.ChooseHookTarget, FiveOfCannons);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.ChooseCannonTarget
            });
        }
예제 #3
0
        public void ChoosingATargetThatWouldBustBusts()
        {
            Game gameFixture = new Game();
            Card FiveOfHooks = new Card()
            {
                Suit = Suites.Hooks, Value = 5
            };
            Card SevenOfHooks = new Card()
            {
                Suit = Suites.Hooks, Value = 7
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfHooks);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, SevenOfHooks, 0);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseHookTarget
            });

            gameFixture.TakeAction(Actions.ChooseHookTarget, SevenOfHooks);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.Draw
            },
                options => options.WithoutStrictOrdering());
            gameFixture.Field.Count.Should().Be(0);
            gameFixture.CurrentPlayersTurn.Should().Be(Players.PlayerTwo);
            gameFixture.ScoreZones[0].PointsShowing().Should().Be(0);
            gameFixture.ScoreZones[1].PointsShowing().Should().Be(0);
            gameFixture.DiscardPile.Count.Should().Be(12);
        }
예제 #4
0
        public void MappingIntoABustBusts()
        {
            Game gameFixture = new Game();
            Card FiveOfMaps  = new Card {
                Suit = Suites.Maps, Value = 5
            };
            Card SevenOfMaps = new Card()
            {
                Suit = Suites.Maps, Value = 7
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfMaps);
            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, SevenOfMaps);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseMapTarget
            });

            gameFixture.GetMapCards();
            gameFixture.TakeAction(Actions.ChooseMapTarget, SevenOfMaps);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.Draw
            },
                options => options.WithoutStrictOrdering());
            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);
        }
예제 #5
0
        public void ChoosingAnInvalidTargetDoesntNothing()
        {
            Game gameFixture = new Game();
            Card FiveOfHooks = new Card()
            {
                Suit = Suites.Hooks, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfHooks);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, FiveOfKeys, 0);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseHookTarget
            });


            gameFixture.TakeAction(Actions.ChooseHookTarget,
                                   new Card()
            {
                Suit = Suites.Chests, Value = 5
            });

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.ChooseHookTarget
            });
            gameFixture.Field.Count.Should().Be(1);
        }
예제 #6
0
        public void AskingForMapCardsReturnsThree()
        {
            Game gameFixture = new Game();
            Card FiveOfMaps  = new Card {
                Suit = Suites.Maps, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };
            Card FiveOfCannons = new Card {
                Suit = Suites.Cannons, Value = 5
            };
            Card FiveOfChests = new Card {
                Suit = Suites.Chests, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfMaps);
            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, FiveOfKeys);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, FiveOfChests);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, FiveOfCannons);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseMapTarget
            });

            var actual = gameFixture.GetMapCards();

            actual.Should().BeEquivalentTo(new List <Card> {
                FiveOfKeys, FiveOfChests, FiveOfCannons
            },
                                           options => options.WithoutStrictOrdering());
        }
예제 #7
0
        public void ChoosingATargetPutsThatCardIntoTheDiscard()
        {
            Game gameFixture   = new Game();
            Card FiveOfCannons = new Card()
            {
                Suit = Suites.Cannons, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfCannons);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, FiveOfKeys, 1);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseCannonTarget
            });
            typeof(Game).GetField("DoesCannonNeedTarget",
                                  BindingFlags.NonPublic | BindingFlags.Instance)
            .SetValue(gameFixture, true);

            gameFixture.TakeAction(Actions.ChooseCannonTarget, FiveOfKeys);

            gameFixture.DiscardPile.Count.Should().Be(11);
            gameFixture.ScoreZones[1].PointsShowing().Should().Be(0);
            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.Draw, Actions.TakeAll
            },
                options => options.WithoutStrictOrdering());
        }
예제 #8
0
        public void ChoosingAnInvalidTargetDoesntNothing()
        {
            Game gameFixture   = new Game();
            Card FiveOfCannons = new Card()
            {
                Suit = Suites.Cannons, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfCannons);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, FiveOfKeys, 1);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseCannonTarget
            });
            typeof(Game).GetField("DoesCannonNeedTarget",
                                  BindingFlags.NonPublic | BindingFlags.Instance)
            .SetValue(gameFixture, true);

            gameFixture.TakeAction(Actions.ChooseCannonTarget,
                                   new Card()
            {
                Suit = Suites.Chests, Value = 5
            });

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.ChooseCannonTarget
            });
            gameFixture.DiscardPile.Count.Should().Be(10);
        }
예제 #9
0
        public void BustingWithAnAnchorOutProtectsEarlierCards()
        {
            Game gameFixture = new Game();
            Card FiveOfKeys  = new Card()
            {
                Suit = Suites.Keys, Value = 5
            };
            Card FiveOfAnchors = new Card()
            {
                Suit = Suites.Anchors, Value = 5
            };
            Card SevenOfKeys = new Card()
            {
                Suit = Suites.Keys, Value = 7
            };

            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfKeys);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfAnchors);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, SevenOfKeys, 0);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.Draw
            });

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.ScoreZones[0].PointsShowing().Should().Be(5);
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Anchors).Should().BeNull();
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Keys).Should().NotBeNull();
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Keys).Value.Should().Be(5);
            gameFixture.DiscardPile.Count.Should().Be(2);
        }
예제 #10
0
        public void TakingBothAChestAndAKeyWhenTheDiscardIsLowYeildsAsMuchAsPossible()
        {
            Game gameFixture = new Game();
            Card FiveOfKeys  = new Card {
                Suit = Suites.Keys, Value = 5
            };
            Card FiveOfChests = new Card {
                Suit = Suites.Chests, Value = 5
            };

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

            gameFixture.TakeAction(Actions.TakeAll);

            gameFixture.ScoreZones[0].PointsShowing().Should().Be(15);
            gameFixture.DiscardPile.Count.Should().Be(0);
        }
예제 #11
0
        public void TakingOnlyAChestDoesNothingSpecial()
        {
            Game gameFixture  = new Game();
            Card FiveOfChests = new Card {
                Suit = Suites.Chests, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfChests);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.TakeAll
            });

            gameFixture.TakeAction(Actions.TakeAll);

            gameFixture.ScoreZones[0].PointsShowing().Should().Be(5);
        }
예제 #12
0
        public void AskingForMapCardsMultipleTimesReturnsTheSameThree()
        {
            Game gameFixture = new Game();
            Card FiveOfMaps  = new Card {
                Suit = Suites.Maps, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfMaps);
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseMapTarget
            });

            var first  = gameFixture.GetMapCards();
            var second = gameFixture.GetMapCards();

            first.Should().BeEquivalentTo(second);
        }
예제 #13
0
        public void ChoosingATargetBringsThatCardIntoTheField()
        {
            Game gameFixture = new Game();
            Card FiveOfMaps  = new Card {
                Suit = Suites.Maps, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfMaps);
            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, FiveOfKeys);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, new Card()
            {
                Suit = Suites.Chests, Value = 5
            });
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, new Card()
            {
                Suit = Suites.Cannons, Value = 5
            });
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.ChooseMapTarget
            });

            gameFixture.GetMapCards();
            gameFixture.TakeAction(Actions.ChooseMapTarget, FiveOfKeys);

            gameFixture.Field.Count.Should().Be(2);
            gameFixture.Field[1].Should().BeEquivalentTo(FiveOfKeys);
            gameFixture.DiscardPile.Count.Should().Be(2);
            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.Draw, Actions.TakeAll
            },
                options => options.WithoutStrictOrdering());
        }
예제 #14
0
        public void BustingWithBothAChestAndAKeyBehindAnAnchorStillGetsABonus()
        {
            Game gameFixture = new Game();
            Card FiveOfKeys  = new Card {
                Suit = Suites.Keys, Value = 5
            };
            Card FiveOfChests = new Card {
                Suit = Suites.Chests, Value = 5
            };

            GameHelpers.ClearDiscardPile(ref gameFixture);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfKeys);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, FiveOfChests);
            GameHelpers.BringCardFromDeckToField(ref gameFixture, new Card {
                Suit = Suites.Anchors, Value = 5
            });
            GameHelpers.BringCardFromDeckToField(ref gameFixture, new Card {
                Suit = Suites.Mermaids, Value = 5
            });
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Mermaids, Value = 9
            }, 0);
            GameHelpers.BringCardFromDeckToDiscardPile(ref gameFixture, new Card {
                Suit = Suites.Oracles, Value = 5
            });
            GameHelpers.SetCurrentActions(ref gameFixture,
                                          new List <Actions> {
                Actions.Draw
            });

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.ScoreZones[0].PointsShowing().Should().Be(15);
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Keys).Value.Should().Be(5);
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Chests).Value.Should().Be(5);
            gameFixture.ScoreZones[0].HighestOfSuit(Suites.Oracles).Value.Should().Be(5);
            gameFixture.DiscardPile.Count.Should().Be(3);
        }