Beispiel #1
0
        public void P1R4_deve_preferire_carta_franca()
        {
            var briscola     = new Card("Spade", 3);
            var previousHand = StateFixture.Create4P(_sut, false, briscola, new[]
            {
                new Card("Coppe", 2),
                new Card("Danari", 9),
                new Card("Coppe", 10),
                new Card("Spade", 8)
            },
                                                     new Card[] { });
            var state = StateFixture.Create4P(_sut, false, briscola, new Card[] { },
                                              new[]
            {
                new Card("Bastoni", 5),
                new Card("Danari", 2),
                new Card("Coppe", 4)
            });
            var me = state.Players.Single(x => x.Strategy == _sut);

            _sut.Watch(me, previousHand);

            var card = _sut.Choose(me, state);

            card.Should().Be.EqualTo(new Card("Coppe", 4));
        }
Beispiel #2
0
        public void P1R4_deve_andare_liscio()
        {
            var briscola = new Card("Spade", 3);
            var state    = StateFixture.Create4P(_sut, false, briscola, new Card[] { },
                                                 new[]
            {
                new Card("Bastoni", 3),
                new Card("Danari", 2),
                new Card("Spade", 4)
            });
            var me = state.Players.Single(x => x.Strategy == _sut);

            var card = _sut.Choose(me, state);

            card.Should().Be.EqualTo(new Card("Danari", 2));
        }
Beispiel #3
0
        public void P1R2_pua_andare_su_con_qualche_punto()
        {
            var briscola = new Card("Spade", 3);
            var state    = StateFixture.Create4P(_sut, true, briscola, new[]
            {
                // In tavola
                new Card("Bastoni", 5)
            },
                                                 new[]
            {
                // In mano
                new Card("Danari", 2),
                new Card("Bastoni", 9),
                new Card("Spade", 4)
            });
            var me = state.Players.First(x => x.Strategy == _sut);

            var card = _sut.Choose(me, state);

            card.Should().Be.EqualTo(new Card("Bastoni", 9));
        }
Beispiel #4
0
        public void P1R2_deve_stare_fuori_se_giocano_briscola()
        {
            var briscola = new Card("Spade", 3);
            var state    = StateFixture.Create4P(_sut, true, briscola, new[]
            {
                // In tavola
                new Card("Spade", 2)
            },
                                                 new[]
            {
                // In mano
                new Card("Danari", 2),
                new Card("Bastoni", 9),
                new Card("Spade", 4)
            });
            var me = state.Players.First(x => x.Strategy == _sut);

            var card = _sut.Choose(me, state);

            card.Should().Be.EqualTo(new Card("Danari", 2));
        }
Beispiel #5
0
        public void P4R4_deve_prendere_il_carico_paesano()
        {
            var sut      = new GrappachuStrategy();
            var briscola = new Card("Spade", 3);
            var state    = StateFixture.Create4P(sut, briscola, new[]
            {
                new Card("Bastoni", 10),
                new Card("Coppe", 10),
                new Card("Spade", 2)
            },
                                                 new[]
            {
                new Card("Bastoni", 7),
                new Card("Danari", 1),
                new Card("Spade", 4)
            });
            var me = state.Players.Single(x => x.Strategy == sut);

            var card = sut.Choose(me, state);

            card.Should().Be.EqualTo(new Card("Spade", 4));
        }
Beispiel #6
0
        public void P4R4_deve_andare_su_preferibilmente_di_carico()
        {
            var sut      = new GrappachuStrategy();
            var briscola = new Card("Spade", 3);
            var state    = StateFixture.Create4P(sut, briscola, new[]
            {
                new Card("Bastoni", 2),
                new Card("Coppe", 1),
                new Card("Bastoni", 9)
            },
                                                 new[]
            {
                new Card("Spade", 1),
                new Card("Bastoni", 10),
                new Card("Spade", 5)
            });
            var me = state.Players.Single(x => x.Strategy == sut);

            var card = sut.Choose(me, state);

            card.Should().Be.EqualTo(new Card("Bastoni", 10));
        }
Beispiel #7
0
        public void P4R4_deve_andare_liscio_se_tagliano()
        {
            var sut      = new GrappachuStrategy();
            var briscola = new Card("Spade", 3);
            var state    = StateFixture.Create4P(sut, briscola, new[]
            {
                new Card("Bastoni", 8),
                new Card("Bastoni", 10),
                new Card("Spade", 2)
            },
                                                 new[]
            {
                new Card("Bastoni", 7),
                new Card("Danari", 1),
                new Card("Spade", 5)
            });
            var me = state.Players.Single(x => x.Strategy == sut);

            var card = sut.Choose(me, state);

            card.Should().Be.EqualTo(new Card("Bastoni", 7));
        }
Beispiel #8
0
        public void P4R4_per_pochi_punti_non_deve_sprecare_l_asso()
        {
            var sut      = new GrappachuStrategy();
            var briscola = new Card("Spade", 3);
            var state    = StateFixture.Create4P(sut, briscola, new[]
            {
                new Card("Bastoni", 10),
                new Card("Coppe", 10),
                new Card("Spade", 2)
            },
                                                 new[]
            {
                new Card("Danari", 1),
                new Card("Spade", 1),
                new Card("Bastoni", 7)
            });
            var me = state.Players.Single(x => x.Strategy == sut);

            var card = sut.Choose(me, state);

            card.Should().Be.EqualTo(new Card("Bastoni", 7));
        }