예제 #1
0
    public void ItemEntryTest()
    {
        // Make sure trying to create an invalid entry results in an error.
        Assert.Throws <ArgumentOutOfRangeException>(
            delegate {
            new PKMN.Database.ItemEntry(PKMN.Item.INVALID, PKMN.Game.SOULSILVER);
        }
            );
        Assert.Throws <ArgumentOutOfRangeException>(
            delegate {
            new PKMN.Database.ItemEntry(PKMN.Item.FAST_BALL, PKMN.Game.NONE);
        }
            );
        Assert.Throws <ArgumentOutOfRangeException>(
            delegate {
            new PKMN.Database.ItemEntry(PKMN.Item.FAST_BALL, PKMN.Game.RED);
        }
            );

        PKMN.Database.ItemEntry itemEntry = new PKMN.Database.ItemEntry(PKMN.Item.FAST_BALL, PKMN.Game.SOULSILVER);

        Assert.AreEqual(itemEntry.Item, PKMN.Item.FAST_BALL);
        Assert.AreEqual(itemEntry.Name, "Fast Ball");
        Assert.AreEqual(itemEntry.Game, PKMN.Game.SOULSILVER);
        Assert.AreEqual(itemEntry.Category, "Apricorn balls");
        Assert.AreEqual(itemEntry.Pocket, "Poké Balls");

        // Just make sure it works
        string description = itemEntry.Description;

        Assert.IsTrue(itemEntry.IsHoldable);
        Assert.AreEqual(itemEntry.FlingPower, 0);
        Assert.AreEqual(itemEntry.FlingEffect, "None");
    }
예제 #2
0
    public void ItemEntryTest()
    {
        PKMN.Database.ItemEntry itemEntry = new PKMN.Database.ItemEntry(PKMN.Item.POTION, PKMN.Game.RED);

        PKMN.Database.ItemEntry itemEntrySame          = new PKMN.Database.ItemEntry(PKMN.Item.POTION, PKMN.Game.RED);
        PKMN.Database.ItemEntry itemEntryDifferentItem = new PKMN.Database.ItemEntry(PKMN.Item.GREAT_BALL, PKMN.Game.RED);
        PKMN.Database.ItemEntry itemEntryDifferentGame = new PKMN.Database.ItemEntry(PKMN.Item.POTION, PKMN.Game.BLUE);

        Assert.AreEqual(itemEntry, itemEntry);
        Assert.AreEqual(itemEntry, itemEntrySame);
        Assert.AreEqual(itemEntry.GetHashCode(), itemEntrySame.GetHashCode());

        Assert.AreNotEqual(itemEntry, itemEntryDifferentItem);
        Assert.AreNotEqual(itemEntry.GetHashCode(), itemEntryDifferentItem.GetHashCode());

        Assert.AreNotEqual(itemEntry, itemEntryDifferentGame);
        Assert.AreNotEqual(itemEntry.GetHashCode(), itemEntryDifferentGame.GetHashCode());
    }