示例#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;
 }