Пример #1
0
        public void DecideOnCard_UnavaiilableCardsTillAvailable_Test()
        {
            // Arrange
            var playerName   = "Test Player";
            var health       = 30;
            var currentMana  = 4;
            var manaCapacity = 5;

            var deck = new List <Card>
            {
                new Card(1),
                new Card(2)
            };

            var hand = new List <Card>
            {
                new Card(3),
                new Card(6),
                new Card(7),
                new Card(8),
            };

            var inputs = new List <string>()
            {
                "1", "4", "3"
            };
            PlayerWithInput player = playerMock.CreateMockInputPlayer(4, playerName, health, currentMana, manaCapacity, deck, hand, inputs);

            // Act
            var(selectedCard, _) = player.DecideOnCard();

            // Assert
            Assert.Equal(3, selectedCard.Point);
        }
Пример #2
0
        public void DecideOnCard_PlayerSkipsTurn_Test()
        {
            // Arrange
            var playerName   = "Test Player";
            var health       = 30;
            var currentMana  = 4;
            var manaCapacity = 5;

            var deck = new List <Card>
            {
                new Card(1),
                new Card(2)
            };

            var hand = new List <Card>
            {
                new Card(3),
                new Card(6),
                new Card(7),
                new Card(8),
            };

            var inputs = new List <string>()
            {
                "P"
            };
            PlayerWithInput player = playerMock.CreateMockInputPlayer(4, playerName, health, currentMana, manaCapacity, deck, hand, inputs);

            // Act
            var(selectedCard, _) = player.DecideOnCard();

            // Assert
            Assert.Null(selectedCard);
            Assert.Equal(4, player.Hand.Count);
        }
Пример #3
0
        public void DecideOnCard_InvalidInputsTillCorrectOne_Test()
        {
            // Arrange
            var playerName   = "Test Player";
            var health       = 30;
            var currentMana  = 4;
            var manaCapacity = 5;

            var deck = new List <Card>
            {
                new Card(1),
                new Card(2)
            };

            var hand = new List <Card>
            {
                new Card(1),
                new Card(2)
            };

            var inputs = new List <string>()
            {
                "a", "b", "2"
            };
            PlayerWithInput player = playerMock.CreateMockInputPlayer(2, playerName, health, currentMana, manaCapacity, deck, hand, inputs);

            // Act
            var(selectedCard, _) = player.DecideOnCard();

            // Assert
            Assert.Equal(2, selectedCard.Point);
        }
Пример #4
0
 public PlayerWithInput CreateMockInputPlayer(int id, string name, int health, int mana, int manaCapacity, List<Card> deck, List<Card> hand, List<string> input)
 {
     PlayerWithInput player = new PlayerWithInput(id, name, health, mana, manaCapacity, deck, hand, input);
     return player;
 }
Пример #5
0
 public PlayerWithInput CreateMockPlayerWithInputAndName(int id, string name, List<string> input)
 {
     PlayerWithInput player = new PlayerWithInput(id, name, input);
     return player;
 }