Пример #1
0
        public void TryGetWinnerTest()
        {
            var testData = new List <Tuple <IList <Deck>, Tuple <bool, Deck> > >()
            {
                new Tuple <IList <Deck>, Tuple <bool, Deck> >(
                    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
                    })
                },
                    new Tuple <bool, Deck>(false, null)),
                new Tuple <IList <Deck>, Tuple <bool, Deck> >(
                    new List <Deck>()
                {
                    new Deck("Player 1", new List <int>()
                    {
                    }),
                    new Deck("Player 2", new List <int>()
                    {
                        3, 2, 10, 6, 8, 5, 9, 4, 7, 1
                    })
                },
                    new Tuple <bool, Deck>(
                        true,
                        new Deck("Player 2", new List <int>()
                {
                    3, 2, 10, 6, 8, 5, 9, 4, 7, 1
                })))
            };

            foreach (var testExample in testData)
            {
                var gameState     = new GameState(testExample.Item1, false);
                var isWinnerFound = CombatHelper.TryGetWinner(gameState, out Deck winner);
                Assert.Equal(testExample.Item2.Item1, isWinnerFound);
                Assert.Equal(testExample.Item2.Item2, winner);
            }
        }