コード例 #1
0
ファイル: SpellTests.cs プロジェクト: sean-nelson/Spells
        public void TestSpellNameChange()
        {
            Spell s = new Teleport ("Mitch's mighty mover");

            StringAssert.IsMatch ("Mitch's mighty mover", s.Name);

            s.Name = "Pete's powerful puller";

            StringAssert.IsMatch ("Pete's powerful puller", s.Name);
        }
コード例 #2
0
ファイル: SpellBookTests.cs プロジェクト: sean-nelson/Spells
        public void TestRemoveSpell()
        {
            SpellBook myBook = new SpellBook ();

            Spell mySpell1 = new Teleport ("Sean's Teleporter");
            Spell mySpell2 = new Heal ("Tom's Healer");
            Spell mySpell3 = new Invisibilty ("Ian's Invisibilty");

            myBook.AddSpell (mySpell1);
            myBook.AddSpell (mySpell2);
            myBook.AddSpell (mySpell3);

            Assert.AreEqual (3, myBook.SpellCount);

            myBook.RemoveSpell (mySpell2);

            Assert.AreEqual (2, myBook.SpellCount);
        }
コード例 #3
0
ファイル: SpellTests.cs プロジェクト: sean-nelson/Spells
 public void TestTeleportCast()
 {
     Spell s = new Teleport ("Teleport");
     string result = s.Cast ();
     Assert.IsTrue (result == "Poof... you appear somewhere else" || result == "Ahhh... I'm too tired to move");
 }