コード例 #1
0
        public void HealthReductedTest()
        {
            Dwarf        gimli = new Dwarf();
            StygianBlade sword = new StygianBlade();
            Orc          dummy = new Orc();
            GoldenCoat   coat  = new GoldenCoat();

            gimli.AddItem(sword);
            dummy.AddItem(coat);

            dummy.ReceiveDamage(gimli.Attack());

            Assert.AreEqual(dummy.HealthMax - dummy.HealthActual, gimli.BaseAttackPower + sword.AttackPower - dummy.BaseDefensePower - coat.DefensePower);
        }
コード例 #2
0
        public void PuttingAttackItemInTest()
        {
            Dwarf gimli  = new Dwarf();
            Orc   dummy1 = new Orc();

            dummy1.ReceiveDamage(gimli.Attack());

            Orc        dummy2 = new Orc();
            BasicSword sword  = new BasicSword();

            gimli.AddItem(sword);

            dummy2.ReceiveDamage(gimli.Attack());

            Assert.AreEqual(dummy1.HealthActual - dummy2.HealthActual, sword.AttackPower);
        }
コード例 #3
0
        public void TwoAttackItemsTest()
        {
            Dwarf gimli  = new Dwarf();
            Orc   dummy1 = new Orc();

            dummy1.ReceiveDamage(gimli.Attack());

            Orc          dummy2 = new Orc();
            BasicSword   sword  = new BasicSword();
            StygianBlade sword2 = new StygianBlade();

            gimli.AddItem(sword);
            gimli.AddItem(sword2);

            dummy2.ReceiveDamage(gimli.Attack());

            Assert.AreEqual(dummy1.HealthActual - dummy2.HealthActual, sword.AttackPower + sword2.AttackPower);
        }
コード例 #4
0
        public void DarkSwordTest()
        {
            Gem       gem1   = new Gem("Fire Gem");
            Gem       gem2   = new Gem("Earth Gem");
            DarkSword sword  = new DarkSword();
            Dwarf     gimli  = new Dwarf();
            Orc       dummy1 = new Orc();
            Orc       dummy2 = new Orc();
            Orc       dummy3 = new Orc();

            gimli.AddItem(sword);
            dummy1.ReceiveDamage(gimli.Attack());

            sword.AddGem(gem1);
            dummy2.ReceiveDamage(gimli.Attack());

            sword.AddGem(gem2);
            dummy3.ReceiveDamage(gimli.Attack());

            Assert.IsTrue(dummy3.HealthActual < dummy2.HealthActual && dummy2.HealthActual < dummy1.HealthActual);
        }