Exemplo 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);
        }
Exemplo n.º 2
0
        public void DoesMatchCombo_ReturnsAsExpected(List <int> i_comboAttempt, bool i_expectedMatch)
        {
            IMonsterData mockMonsterData = Substitute.For <IMonsterData>();

            mockMonsterData.GetAttackCombo().Returns(new List <int>()
            {
                1, 2, 3
            });

            List <IGamePiece> comboAttempt = new List <IGamePiece>();

            if (i_comboAttempt != null)
            {
                foreach (int pieceType in i_comboAttempt)
                {
                    IGamePiece mockPiece = Substitute.For <IGamePiece>();
                    mockPiece.PieceType.Returns(pieceType);
                    comboAttempt.Add(mockPiece);
                }
            }

            GameMonster systemUnderTest = new GameMonster(mockMonsterData);

            bool doesMatch = systemUnderTest.DoesMatchCombo(comboAttempt);

            Assert.AreEqual(i_expectedMatch, doesMatch);
        }
Exemplo n.º 3
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();
 }