Example #1
0
        public void TryStartSubgameTest()
        {
            var testData = new List <Tuple <GameState, Tuple <bool, GameState> > >()
            {
                new Tuple <GameState, Tuple <bool, GameState> >(
                    new GameState(new List <Deck>()
                {
                    new Deck("Player 1", new List <int>()
                    {
                        9, 2, 6, 3, 1
                    }),
                    new Deck("Player 2", new List <int>()
                    {
                        5, 8, 4, 7, 10
                    })
                }, false),
                    new Tuple <bool, GameState>(
                        false,
                        null)),
                new Tuple <GameState, Tuple <bool, GameState> >(
                    new GameState(new List <Deck>()
                {
                    new Deck("Player 1", new List <int>()
                    {
                        9, 2, 6, 3, 1, 5, 8, 4, 7, 10
                    }),
                    new Deck("Player 2", new List <int>()
                    {
                    })
                }, false),
                    new Tuple <bool, GameState>(
                        false,
                        null)),
                new Tuple <GameState, Tuple <bool, GameState> >(
                    new GameState(new List <Deck>()
                {
                    new Deck("Player 1", new List <int>()
                    {
                        4, 9, 8, 5, 2
                    }),
                    new Deck("Player 2", new List <int>()
                    {
                        3, 10, 1, 7, 6
                    })
                }, false),
                    new Tuple <bool, GameState>(
                        true,
                        new GameState(new List <Deck>()
                {
                    new Deck("Player 1", new List <int>()
                    {
                        9, 8, 5, 2
                    }),
                    new Deck("Player 2", new List <int>()
                    {
                        10, 1, 7
                    })
                }, false))),
                new Tuple <GameState, Tuple <bool, GameState> >(
                    new GameState(new List <Deck>()
                {
                    new Deck("Player 1", new List <int>()
                    {
                        2, 8, 1
                    }),
                    new Deck("Player 2", new List <int>()
                    {
                        6, 3, 4, 10, 9, 7, 5
                    })
                }, false),
                    new Tuple <bool, GameState>(
                        true,
                        new GameState(new List <Deck>()
                {
                    new Deck("Player 1", new List <int>()
                    {
                        8, 1
                    }),
                    new Deck("Player 2", new List <int>()
                    {
                        3, 4, 10, 9, 7, 5
                    })
                }, false))),
            };

            foreach (var testExample in testData)
            {
                var isShouldStartSubgame = CombatHelper.TryStartSubgame(
                    testExample.Item1,
                    out GameState subgameState);
                Assert.Equal(testExample.Item2.Item1, isShouldStartSubgame);
                Assert.Equal(testExample.Item2.Item2, subgameState);
            }
        }