Exemplo n.º 1
0
    public void AttackTest()
    {
        MeleeUnit testAttacker = new MeleeUnit(100, 10, 10, float.MaxValue);
        MeleeUnit testDefender = new MeleeUnit(100, 10, 10, float.MaxValue);
        testAttacker.AttackCost = 1;
        testAttacker.IsNotTesting = false;
        testAttacker.Attack(testDefender);

        int expected = 90;
        int actual = testDefender.Health;

        Assert.AreEqual(expected, actual);
    }
Exemplo n.º 2
0
    public void AttackIfAPIsGreaterThanAC()
    {
        MeleeUnit testAttacker = new MeleeUnit(100, 10, 10, float.MaxValue);
        MeleeUnit testDefender = new MeleeUnit(100, 10, 10, float.MaxValue);
        testAttacker.AttackCost = 3;
        testAttacker.IsNotTesting = false;
        testAttacker.Attack(testDefender);

        int expectedAC = 7;
        int actualAC = testAttacker.ActionPoints;
        int expctedHP = 90;
        int actualHP = testDefender.Health;

        Assert.AreEqual(expectedAC, actualAC);
        Assert.AreEqual(expctedHP, actualHP);
    }
Exemplo n.º 3
0
    public void NoAttackIfACIsZero()
    {
        MeleeUnit testAttacker = new MeleeUnit(100, -100, 10, float.MaxValue);
        MeleeUnit testDefender = new MeleeUnit(100, 10, 10, float.MaxValue);
        testAttacker.AttackCost = 0;
        testAttacker.IsNotTesting = false;
        testAttacker.Attack(testDefender);

        int expectedAP = 10;
        int actualAP = testAttacker.ActionPoints;
        int expected = 100;
        int actual = testDefender.Health;

        Assert.AreEqual(expectedAP, actualAP);
        Assert.AreEqual(expected, actual);
    }
Exemplo n.º 4
0
    public void NoDamageWhenLessThanZero()
    {
        MeleeUnit testAttacker = new MeleeUnit(100, -100, 10, float.MaxValue);
        MeleeUnit testDefender = new MeleeUnit(100, 10, 10, float.MaxValue);
        testAttacker.AttackCost = 1;
        testAttacker.IsNotTesting = false;
        testAttacker.Attack(testDefender);

        int expected = 100;
        int actual = testDefender.Health;
        Assert.AreEqual(expected, actual);
    }
Exemplo n.º 5
0
    public void NoAttackIfAPIsLessThanAC()
    {
        MeleeUnit testAttacker = new MeleeUnit(100, 100, 10, float.MaxValue);
        MeleeUnit testDefender = new MeleeUnit(100, 10, 10, float.MaxValue);
        testAttacker.AttackCost = 11;
        testAttacker.IsNotTesting = false;
        testAttacker.Attack(testDefender);

        int expectedAP = 10;
        int actualAP = testAttacker.ActionPoints;
        int expectedHealth = 100;
        int actualHealth = testDefender.Health;

        Assert.AreEqual(expectedAP, actualAP);
        Assert.AreEqual(expectedHealth, actualHealth);
    }