コード例 #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);
        }
コード例 #2
0
ファイル: GameMonster.cs プロジェクト: jlavoine/CrossMonsters
 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();
 }