Ejemplo 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);
        }
Ejemplo 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();
 }
Ejemplo n.º 3
0
        public void AfterTick_IfLappingCycle_CorrectNumberOfAttacksSent(long i_tick, int i_expectedAttacks)
        {
            IMonsterData mockMonsterData = Substitute.For <IMonsterData>();

            mockMonsterData.GetAttackRate().Returns(1000);

            GameMonster systemUnderTest = new GameMonster(mockMonsterData);

            systemUnderTest.Tick(i_tick);

            MyMessenger.Instance.Received(i_expectedAttacks).Send <IGameMonster>(GameMessages.MONSTER_ATTACK, systemUnderTest);
        }
Ejemplo n.º 4
0
        public void GetAttackProgress_ReturnsAsExpected(long i_curAttackCycle, long i_attackRate, float i_expected)
        {
            IMonsterData mockMonsterData = Substitute.For <IMonsterData>();

            mockMonsterData.GetAttackRate().Returns(i_attackRate);

            GameMonster systemUnderTest = new GameMonster(mockMonsterData);

            systemUnderTest.Tick(i_curAttackCycle);

            Assert.AreEqual(i_expected, systemUnderTest.GetAttackProgress());
        }
Ejemplo n.º 5
0
        public void AfterTick_IfLappingCycle_ValueIsAsExpected()
        {
            IMonsterData mockMonsterData = Substitute.For <IMonsterData>();

            mockMonsterData.GetAttackRate().Returns(1000);

            GameMonster systemUnderTest = new GameMonster(mockMonsterData);

            systemUnderTest.Tick(2254);

            Assert.AreEqual(254, systemUnderTest.AttackCycle);
        }
Ejemplo n.º 6
0
        public void NegativeTicks_DoNotChangeAttackCycle()
        {
            IMonsterData mockMonsterData = Substitute.For <IMonsterData>();

            mockMonsterData.GetAttackRate().Returns(1000);

            GameMonster systemUnderTest = new GameMonster(mockMonsterData);

            systemUnderTest.Tick(-1000);

            Assert.AreEqual(0, systemUnderTest.AttackCycle);
        }
Ejemplo n.º 7
0
        public void AfterTick_AttackCycleResetsToZero_WhenTickEqualsRate()
        {
            IMonsterData mockMonsterData = Substitute.For <IMonsterData>();

            mockMonsterData.GetAttackRate().Returns(1000);

            GameMonster systemUnderTest = new GameMonster(mockMonsterData);

            systemUnderTest.Tick(1000);

            Assert.AreEqual(0, systemUnderTest.AttackCycle);
        }
Ejemplo n.º 8
0
        public void AfterTick_WhenAttackIsNotCycled_ValueIsAsExpected()
        {
            IMonsterData mockMonsterData = Substitute.For <IMonsterData>();

            mockMonsterData.GetAttackRate().Returns(1000);

            GameMonster systemUnderTest = new GameMonster(mockMonsterData);

            systemUnderTest.Tick(100);

            Assert.AreEqual(100, systemUnderTest.AttackCycle);
        }