예제 #1
0
        public void TryPlayClassicRoundTest()
        {
            var testData = new List <Tuple <IList <IList <int> >, IList <IList <int> >, bool> >()
            {
                new Tuple <IList <IList <int> >, IList <IList <int> >, bool>(
                    new List <IList <int> >()
                {
                    new List <int>()
                    {
                        9, 2, 6, 3, 1
                    },
                    new List <int>()
                    {
                        5, 8, 4, 7, 10
                    }
                },
                    new List <IList <int> >()
                {
                    new List <int>()
                    {
                        2, 6, 3, 1, 9, 5
                    },
                    new List <int>()
                    {
                        8, 4, 7, 10
                    }
                },
                    true),
                new Tuple <IList <IList <int> >, IList <IList <int> >, bool>(
                    new List <IList <int> >()
                {
                    new List <int>()
                    {
                        1
                    },
                    new List <int>()
                    {
                        7, 3, 2, 10, 6, 8, 5, 9, 4
                    }
                },
                    new List <IList <int> >()
                {
                    new List <int>()
                    {
                    },
                    new List <int>()
                    {
                        3, 2, 10, 6, 8, 5, 9, 4, 7, 1
                    }
                },
                    true),
                new Tuple <IList <IList <int> >, IList <IList <int> >, bool>(
                    new List <IList <int> >()
                {
                    new List <int>()
                    {
                    },
                    new List <int>()
                    {
                        3, 2, 10, 6, 8, 5, 9, 4, 7, 1
                    }
                },
                    new List <IList <int> >()
                {
                    new List <int>()
                    {
                    },
                    new List <int>()
                    {
                        3, 2, 10, 6, 8, 5, 9, 4, 7, 1
                    }
                },
                    false),
            };

            foreach (var testExample in testData)
            {
                var decks = new List <Deck>();
                foreach (var cardList in testExample.Item1)
                {
                    var deck = new Deck(string.Empty, cardList);
                    decks.Add(deck);
                }
                var initialGameState = new GameState(decks, false);
                var areStillPlaying  = CombatHelper.TryPlayClassicRound(
                    initialGameState,
                    out GameState finalGameState);
                var cardLists = finalGameState.Decks.Select(deck => deck.SpaceCards.ToList()).ToList();
                Assert.Equal(testExample.Item2, cardLists);
                Assert.Equal(testExample.Item3, areStillPlaying);
            }
        }