コード例 #1
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);
        }
コード例 #2
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());
        }
コード例 #3
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
            });
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: Cannons.cs プロジェクト: KevinUre/Boardgame-AIs
        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());
        }
コード例 #6
0
ファイル: Cannons.cs プロジェクト: KevinUre/Boardgame-AIs
        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);
        }
コード例 #7
0
        public void DrawingIntoAHookMakesYouChooseTarget()
        {
            Game gameFixture = new Game();
            Card FiveOfHooks = new Card()
            {
                Suit = Suites.Hooks, Value = 5
            };
            Card FiveOfKeys = new Card {
                Suit = Suites.Keys, Value = 5
            };

            GameHelpers.BringCardToPositionInDeck(ref gameFixture, FiveOfHooks, 0);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, FiveOfKeys, 0);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions>()
            {
                Actions.ChooseHookTarget
            });
        }
コード例 #8
0
        public void DrawingACannonFirstPausesTheKrakenButResumesAfterAShotWasTaken()
        {
            Game gameFixture = new Game();

            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Krakens, Value = 5
            }, 0);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Cannons, Value = 5
            }, 1);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Oracles, Value = 5
            }, 2);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, new Card {
                Suit = Suites.Keys, Value = 5
            }, 1);
            GameHelpers.ClearDiscardPile(ref gameFixture);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(new List <Actions> {
                Actions.CannonThenBackToKraken
            });
            gameFixture.Field.Count.Should().Be(2);

            gameFixture.TakeAction(Actions.CannonThenBackToKraken, new Card {
                Suit = Suites.Keys, Value = 5
            });
            gameFixture.DiscardPile.Count.Should().Be(1);
            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(
                new List <Actions> {
                Actions.Draw, Actions.TakeAll
            },
                options => options.WithoutStrictOrdering());
            gameFixture.Field.Count.Should().Be(3);
            gameFixture.Field[2].Should().Match(a => (a as Card).Suit == Suites.Oracles && (a as Card).Value == 5);
        }
コード例 #9
0
        public void DrawingASwordFirstEndsTheKraken()
        {
            Game gameFixture = new Game();

            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Krakens, Value = 5
            }, 0);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Swords, Value = 5
            }, 1);
            GameHelpers.BringCardToPositionInDeck(ref gameFixture, new Card {
                Suit = Suites.Oracles, Value = 5
            }, 2);
            GameHelpers.BringCardFromDeckToScoreZone(ref gameFixture, new Card {
                Suit = Suites.Keys, Value = 5
            }, 1);

            gameFixture.TakeAction(Actions.Draw);

            gameFixture.CurrentAvailableActions.Should().BeEquivalentTo(new List <Actions> {
                Actions.ChooseSwordTarget
            });
            gameFixture.Field.Count.Should().Be(2);
        }