Esempio n. 1
0
        public void WhenCreating_StatsSetToDataValues()
        {
            List <int> mockAttackCombo = new List <int>()
            {
                1, 2, 3
            };

            IMonsterData mockData = Substitute.For <IMonsterData>();

            mockData.GetDefense().Returns(10);
            mockData.GetDefenseType().Returns(2);
            mockData.GetAttackRate().Returns(1500);
            mockData.GetDamage().Returns(1000);
            mockData.GetDamageType().Returns(30);
            mockData.GetAttackCombo().Returns(mockAttackCombo);
            mockData.GetId().Returns("Blob");

            GameMonster systemUnderTest = new GameMonster(mockData);

            Assert.AreEqual(10, systemUnderTest.Defense);
            Assert.AreEqual(2, systemUnderTest.DefenseType);
            Assert.AreEqual(1500, systemUnderTest.AttackRate);
            Assert.AreEqual(1000, systemUnderTest.AttackPower);
            Assert.AreEqual(30, systemUnderTest.AttackType);
            Assert.AreEqual(mockAttackCombo, systemUnderTest.AttackCombo);
            Assert.AreEqual("Blob", systemUnderTest.Id);
        }
Esempio n. 2
0
 private void SetStats(IMonsterData i_data)
 {
     RemainingHP = i_data.GetMaxHP();
     Defense     = i_data.GetDefense();
     DefenseType = i_data.GetDefenseType();
     AttackPower = i_data.GetDamage();
     AttackType  = i_data.GetDamageType();
     AttackRate  = i_data.GetAttackRate();
     AttackCombo = i_data.GetAttackCombo();
     Id          = i_data.GetId();
 }
Esempio n. 3
0
        public void WhenAttackedByPlayer_ExpectedDamageRemovedFromRemainingHP(int i_playerAttackPower, int i_monsterDefense, int i_expectedDamage)
        {
            IGamePlayer mockPlayer = Substitute.For <IGamePlayer>();

            mockPlayer.GetAttackPowerForType(Arg.Any <int>()).Returns(i_playerAttackPower);

            IMonsterData mockMonsterData = Substitute.For <IMonsterData>();

            mockMonsterData.GetMaxHP().Returns(100);
            mockMonsterData.GetDefense().Returns(i_monsterDefense);

            GameMonster systemUnderTest = new GameMonster(mockMonsterData);

            systemUnderTest.AttackedByPlayer(mockPlayer);

            int expectedHP = 100 - i_expectedDamage;

            Assert.AreEqual(expectedHP, systemUnderTest.RemainingHP);
        }