コード例 #1
0
        public static void TMHMPocketTest(
            PKMN.ItemList tmhmPocket,
            PKMN.Game game
            )
        {
            int    expectedLength = 0;
            string expectedName   = "";

            if ((game == PKMN.Game.FIRERED) || (game == PKMN.Game.LEAFGREEN))
            {
                expectedLength = 58;
                expectedName   = "TM Case";
            }
            else
            {
                expectedLength = 64;
                expectedName   = "TMs & HMs";
            }

            // Check unchanging and initial values.
            Assert.AreEqual(tmhmPocket.Name, expectedName);
            Assert.AreEqual(tmhmPocket.Game, game);
            Assert.AreEqual(tmhmPocket.Length, expectedLength);
            Assert.AreEqual(tmhmPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(tmhmPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                tmhmPocket,
                PKMN.Item.TM01
                );

            // Confirm items from other pockets can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                tmhmPocket,
                new PKMN.Item[]
            {
                PKMN.Item.POTION,
                PKMN.Item.BICYCLE,
                PKMN.Item.GREAT_BALL,
                PKMN.Item.RAZZ_BERRY
            }
                );

            // Confirm items from later generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                tmhmPocket,
                new PKMN.Item[]
            {
                PKMN.Item.TM51
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.TM01,
                PKMN.Item.HM01,
                PKMN.Item.TM02,
                PKMN.Item.HM02,
                PKMN.Item.TM03,
                PKMN.Item.HM03,
                PKMN.Item.TM04,
                PKMN.Item.HM04
            };
            ItemsTestsCommon.TestItemListSettingItems(
                tmhmPocket,
                validItems
                );
            ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                tmhmPocket,
                validItems
                );

            Assert.AreEqual(tmhmPocket.ValidItems.Count, tmhmPocket.ValidItemNames.Count);
            Assert.Greater(tmhmPocket.ValidItems.Count, 0);
        }
コード例 #2
0
        public static void ItemPocketTest(
            PKMN.ItemList itemPocket,
            PKMN.Game game
            )
        {
            int expectedLength = 0;

            if ((game == PKMN.Game.RUBY) || (game == PKMN.Game.SAPPHIRE))
            {
                expectedLength = 20;
            }
            else if (game == PKMN.Game.EMERALD)
            {
                expectedLength = 30;
            }
            else
            {
                expectedLength = 42;
            }

            // Check unchanging and initial values.
            Assert.AreEqual(itemPocket.Name, "Items");
            Assert.AreEqual(itemPocket.Game, game);
            Assert.AreEqual(itemPocket.Length, expectedLength);
            Assert.AreEqual(itemPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(itemPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                itemPocket,
                PKMN.Item.POTION
                );

            // Confirm items from other pockets can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                itemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.BICYCLE,
                PKMN.Item.MASTER_BALL,
                PKMN.Item.HM01,
                PKMN.Item.RAZZ_BERRY
            }
                );

            // Confirm items from other generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                itemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.PINK_BOW,
                PKMN.Item.BLACK_SLUDGE,
                PKMN.Item.BINDING_BAND,
                PKMN.Item.BEEDRILLITE
            }
                );

            // Make sure we can't add items from Gamecube games.
            ItemsTestsCommon.TestItemListInvalidItems(
                itemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.TIME_FLUTE,
                PKMN.Item.POKE_SNACK
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.POTION,
                PKMN.Item.ORANGE_MAIL,
                PKMN.Item.LAVA_COOKIE,
                PKMN.Item.STARDUST,
                PKMN.Item.SHADOW_MAIL,
                PKMN.Item.PINK_SCARF,
                PKMN.Item.ANTIDOTE,
                PKMN.Item.GREEN_SHARD
            };
            ItemsTestsCommon.TestItemListSettingItems(
                itemPocket,
                validItems
                );
            ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                itemPocket,
                validItems
                );

            Assert.AreEqual(itemPocket.ValidItems.Count, itemPocket.ValidItemNames.Count);
            Assert.Greater(itemPocket.ValidItems.Count, 0);
        }
コード例 #3
0
        public static void KeyItemPocketTest(
            PKMN.ItemList keyItemPocket,
            PKMN.Game game
            )
        {
            int expectedLength = 0;

            if ((game == PKMN.Game.RUBY) || (game == PKMN.Game.SAPPHIRE))
            {
                expectedLength = 20;
            }
            else
            {
                expectedLength = 30;
            }

            // Check unchanging and initial values.
            Assert.AreEqual(keyItemPocket.Name, "Key Items");
            Assert.AreEqual(keyItemPocket.Game, game);
            Assert.AreEqual(keyItemPocket.Length, expectedLength);
            Assert.AreEqual(keyItemPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(keyItemPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                keyItemPocket,
                PKMN.Item.BASEMENT_KEY
                );

            // Confirm items from other pockets can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                keyItemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.POTION,
                PKMN.Item.MASTER_BALL,
                PKMN.Item.HM01,
                PKMN.Item.RAZZ_BERRY
            }
                );

            // Confirm items from other generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                keyItemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.GS_BALL,
                PKMN.Item.POFFIN_CASE,
                PKMN.Item.DNA_SPLICERS,
                PKMN.Item.AQUA_SUIT
            }
                );

            // Confirm items from incompatible Generation III games can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                keyItemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.EIN_FILE_S,
                PKMN.Item.POWERUP_PART,
                PKMN.Item.GONZAPS_KEY,
                PKMN.Item.KRANE_MEMO_1
            }
                );
            if ((game == PKMN.Game.RUBY) || (game == PKMN.Game.SAPPHIRE))
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    keyItemPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.HELIX_FOSSIL,
                    PKMN.Item.TEA,
                    PKMN.Item.RUBY
                }
                    );
            }
            if (game != PKMN.Game.EMERALD)
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    keyItemPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.MAGMA_EMBLEM,
                    PKMN.Item.OLD_SEA_MAP
                }
                    );
            }

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.WAILMER_PAIL,
                PKMN.Item.BASEMENT_KEY,
                PKMN.Item.METEORITE,
                PKMN.Item.OLD_ROD,
                PKMN.Item.RED_ORB,
                PKMN.Item.ROOT_FOSSIL,
                PKMN.Item.CONTEST_PASS,
                PKMN.Item.EON_TICKET
            };
            ItemsTestsCommon.TestItemListSettingItems(
                keyItemPocket,
                validItems
                );
            ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                keyItemPocket,
                validItems
                );

            Assert.AreEqual(keyItemPocket.ValidItems.Count, keyItemPocket.ValidItemNames.Count);
            Assert.Greater(keyItemPocket.ValidItems.Count, 0);
        }
コード例 #4
0
        public static void BallPocketTest(
            PKMN.ItemList ballPocket,
            PKMN.Game game
            )
        {
            int expectedLength = 0;

            if ((game == PKMN.Game.FIRERED) || (game == PKMN.Game.LEAFGREEN))
            {
                expectedLength = 13;
            }
            else
            {
                expectedLength = 16;
            }

            // Check unchanging and initial values.
            Assert.AreEqual(ballPocket.Name, "Poké Balls");
            Assert.AreEqual(ballPocket.Game, game);
            Assert.AreEqual(ballPocket.Length, expectedLength);
            Assert.AreEqual(ballPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(ballPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                ballPocket,
                PKMN.Item.MASTER_BALL
                );

            // Confirm items from other pockets can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                ballPocket,
                new PKMN.Item[]
            {
                PKMN.Item.POTION,
                PKMN.Item.BICYCLE,
                PKMN.Item.HM01,
                PKMN.Item.RAZZ_BERRY
            }
                );

            // Confirm items from later generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                ballPocket,
                new PKMN.Item[]
            {
                PKMN.Item.MOON_BALL,
                PKMN.Item.HEAL_BALL,
                PKMN.Item.DREAM_BALL
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.MASTER_BALL,
                PKMN.Item.ULTRA_BALL,
                PKMN.Item.GREAT_BALL,
                PKMN.Item.POKE_BALL,
                PKMN.Item.SAFARI_BALL,
                PKMN.Item.NET_BALL,
                PKMN.Item.DIVE_BALL,
                PKMN.Item.NEST_BALL
            };
            ItemsTestsCommon.TestItemListSettingItems(
                ballPocket,
                validItems
                );
            ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                ballPocket,
                validItems
                );

            Assert.AreEqual(ballPocket.ValidItems.Count, ballPocket.ValidItemNames.Count);
            Assert.Greater(ballPocket.ValidItems.Count, 0);
        }
コード例 #5
0
        public static void BallPocketTest(
            PKMN.ItemList ballPocket,
            PKMN.Game game
            )
        {
            // Check unchanging and initial values.
            Assert.AreEqual(ballPocket.Name, "Balls");
            Assert.AreEqual(ballPocket.Game, game);
            Assert.AreEqual(ballPocket.Length, 12);
            Assert.AreEqual(ballPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(ballPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                ballPocket,
                PKMN.Item.MASTER_BALL
                );

            // Confirm items from other pockets can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                ballPocket,
                new PKMN.Item[]
            {
                PKMN.Item.POTION,
                PKMN.Item.BICYCLE,
                PKMN.Item.HM01
            }
                );

            // Confirm items from later generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                ballPocket,
                new PKMN.Item[]
            {
                PKMN.Item.PREMIER_BALL,
                PKMN.Item.HEAL_BALL,
                PKMN.Item.DREAM_BALL
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.GREAT_BALL,
                PKMN.Item.POKE_BALL,
                PKMN.Item.PARK_BALL,
                PKMN.Item.FAST_BALL,
                PKMN.Item.MASTER_BALL,
                PKMN.Item.FRIEND_BALL,
                PKMN.Item.LOVE_BALL,
                PKMN.Item.LEVEL_BALL
            };
            ItemsTestsCommon.TestItemListSettingItems(
                ballPocket,
                validItems
                );
            ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                ballPocket,
                validItems
                );

            Assert.AreEqual(ballPocket.ValidItems.Count, ballPocket.ValidItemNames.Count);
            Assert.Greater(ballPocket.ValidItems.Count, 0);
        }
コード例 #6
0
        public static void ItemPocketTest(
            PKMN.ItemList itemPocket,
            PKMN.Game game
            )
        {
            // Check unchanging and initial values.
            Assert.AreEqual(itemPocket.Name, "Items");
            Assert.AreEqual(itemPocket.Game, game);
            Assert.AreEqual(itemPocket.Length, 20);
            Assert.AreEqual(itemPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(itemPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                itemPocket,
                PKMN.Item.POTION
                );

            // Confirm items from other pockets can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                itemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.BICYCLE,
                PKMN.Item.MASTER_BALL,
                PKMN.Item.HM01
            }
                );

            // Confirm items from later generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                itemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.BLACK_FLUTE,
                PKMN.Item.BLACK_SLUDGE,
                PKMN.Item.BINDING_BAND,
                PKMN.Item.BEEDRILLITE
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.POTION,
                PKMN.Item.HP_UP,
                PKMN.Item.WHITE_APRICORN,
                PKMN.Item.LUCKY_EGG,
                PKMN.Item.FLOWER_MAIL,
                PKMN.Item.BURN_HEAL,
                PKMN.Item.PSNCUREBERRY,
                PKMN.Item.STICK
            };
            ItemsTestsCommon.TestItemListSettingItems(
                itemPocket,
                validItems
                );
            ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                itemPocket,
                validItems
                );

            Assert.AreEqual(itemPocket.ValidItems.Count, itemPocket.ValidItemNames.Count);
            Assert.Greater(itemPocket.ValidItems.Count, 0);
        }
コード例 #7
0
ファイル: GCNItemsTests.cs プロジェクト: ncorgan/libpkmn
        public static void ColognePocketTest(
            PKMN.ItemList colognePocket,
            PKMN.Game game
            )
        {
            bool colosseum      = (game == PKMN.Game.COLOSSEUM);
            int  expectedLength = 3;

            // Check unchanging and initial values.
            Assert.AreEqual(colognePocket.Name, "Colognes");
            Assert.AreEqual(colognePocket.Game, game);
            Assert.AreEqual(colognePocket.Length, expectedLength);
            Assert.AreEqual(colognePocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(colognePocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                colognePocket,
                PKMN.Item.JOY_SCENT
                );

            // Confirm items from other pockets can't be added.
            if (colosseum)
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    colognePocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.EIN_FILE_S,
                    PKMN.Item.POTION,
                    PKMN.Item.MASTER_BALL,
                    PKMN.Item.TM01,
                    PKMN.Item.ORAN_BERRY
                }
                    );
            }
            else
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    colognePocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.GONZAPS_KEY,
                    PKMN.Item.POTION,
                    PKMN.Item.MASTER_BALL,
                    PKMN.Item.TM01,
                    PKMN.Item.ORAN_BERRY,
                    PKMN.Item.BATTLE_CD_01
                }
                    );
            }

            colognePocket.Add(PKMN.Item.JOY_SCENT, 3);
            colognePocket.Add(PKMN.Item.EXCITE_SCENT, 3);
            colognePocket.Add(PKMN.Item.VIVID_SCENT, 3);

            colognePocket.Remove(PKMN.Item.EXCITE_SCENT, 3);
            colognePocket.Remove(PKMN.Item.VIVID_SCENT, 1);

            Assert.AreEqual(colognePocket[0].Item, PKMN.Item.JOY_SCENT);
            Assert.AreEqual(colognePocket[0].Amount, 3);
            Assert.AreEqual(colognePocket[1].Item, PKMN.Item.VIVID_SCENT);
            Assert.AreEqual(colognePocket[1].Amount, 2);
            Assert.AreEqual(colognePocket[2].Item, PKMN.Item.NONE);
            Assert.AreEqual(colognePocket[2].Amount, 0);

            colognePocket.Remove(PKMN.Item.JOY_SCENT, 3);
            colognePocket.Remove(PKMN.Item.VIVID_SCENT, 2);

            Assert.AreEqual(colognePocket[0].Item, PKMN.Item.NONE);
            Assert.AreEqual(colognePocket[0].Amount, 0);
            Assert.AreEqual(colognePocket[1].Item, PKMN.Item.NONE);
            Assert.AreEqual(colognePocket[1].Amount, 0);
            Assert.AreEqual(colognePocket[2].Item, PKMN.Item.NONE);
            Assert.AreEqual(colognePocket[2].Amount, 0);

            Assert.AreEqual(colognePocket.ValidItems.Count, colognePocket.ValidItemNames.Count);
            Assert.AreEqual(colognePocket.ValidItems.Count, 3);
        }
コード例 #8
0
        public static void KeyItemPocketTest(
            PKMN.ItemList keyItemPocket,
            PKMN.Game game
            )
        {
            // Check unchanging and initial values.
            Assert.AreEqual(keyItemPocket.Name, "KeyItems");
            Assert.AreEqual(keyItemPocket.Game, game);
            Assert.AreEqual(keyItemPocket.Length, 25);
            Assert.AreEqual(keyItemPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(keyItemPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                keyItemPocket,
                PKMN.Item.BICYCLE
                );

            // Confirm items from other pockets can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                keyItemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.POTION,
                PKMN.Item.MASTER_BALL,
                PKMN.Item.HM01
            }
                );

            // Confirm items from later generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                keyItemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.MACH_BIKE,
                PKMN.Item.JADE_ORB,
                PKMN.Item.LIGHT_STONE,
                PKMN.Item.AQUA_SUIT
            }
                );

            // Crystal-specific items.
            if (game == PKMN.Game.CRYSTAL)
            {
                foreach (PKMN.Item crystalItem in CrystalItems)
                {
                    keyItemPocket.Add(crystalItem, 1);
                    keyItemPocket.Remove(crystalItem, 1);
                }

                Assert.AreEqual(keyItemPocket.NumItems, 0);
            }
            else
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    keyItemPocket,
                    CrystalItems
                    );
            }

            // Make sure we can't add or remove more than a single item.
            Assert.Throws <IndexOutOfRangeException>(
                delegate
            {
                keyItemPocket.Add(PKMN.Item.BICYCLE, 5);
            }
                );
            Assert.Throws <IndexOutOfRangeException>(
                delegate
            {
                keyItemPocket.Remove(PKMN.Item.BICYCLE, 5);
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.BICYCLE,
                PKMN.Item.BASEMENT_KEY,
                PKMN.Item.SECRETPOTION,
                PKMN.Item.MYSTERY_EGG,
                PKMN.Item.SILVER_WING,
                PKMN.Item.LOST_ITEM,
                PKMN.Item.SQUIRT_BOTTLE,
                PKMN.Item.RAINBOW_WING
            };

            for (int itemIndex = 0; itemIndex < validItems.Length; ++itemIndex)
            {
                if (itemIndex < 4)
                {
                    keyItemPocket.Add(validItems[itemIndex], 1);
                }
                else
                {
                    keyItemPocket[itemIndex].Item = validItems[itemIndex];
                }
            }

            keyItemPocket.Remove(validItems[2], 1);
            keyItemPocket[2].Item = PKMN.Item.NONE;
            Assert.AreEqual(keyItemPocket.NumItems, 6);

            // Empty the rest for the bag test.
            while (keyItemPocket[0].Item != PKMN.Item.NONE)
            {
                keyItemPocket[0].Item = PKMN.Item.NONE;
            }

            Assert.AreEqual(keyItemPocket.ValidItems.Count, keyItemPocket.ValidItemNames.Count);
            Assert.Greater(keyItemPocket.ValidItems.Count, 0);
        }
コード例 #9
0
ファイル: GCNItemsTests.cs プロジェクト: ncorgan/libpkmn
        public static void ItemPocketTest(
            PKMN.ItemList itemPocket,
            PKMN.Game game
            )
        {
            bool colosseum      = (game == PKMN.Game.COLOSSEUM);
            int  expectedLength = colosseum ? 20 : 30;

            // Check unchanging and initial values.
            Assert.AreEqual(itemPocket.Name, "Items");
            Assert.AreEqual(itemPocket.Game, game);
            Assert.AreEqual(itemPocket.Length, expectedLength);
            Assert.AreEqual(itemPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(itemPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                itemPocket,
                PKMN.Item.POTION
                );

            // Confirm items from other pockets can't be added.
            if (colosseum)
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    itemPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.EIN_FILE_S,
                    PKMN.Item.GREAT_BALL,
                    PKMN.Item.TM01,
                    PKMN.Item.ORAN_BERRY,
                    PKMN.Item.JOY_SCENT
                }
                    );
            }
            else
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    itemPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.GONZAPS_KEY,
                    PKMN.Item.GREAT_BALL,
                    PKMN.Item.TM01,
                    PKMN.Item.ORAN_BERRY,
                    PKMN.Item.BATTLE_CD_01
                }
                    );
            }

            // Confirm items from other generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                itemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.PINK_BOW,
                PKMN.Item.BLACK_SLUDGE,
                PKMN.Item.BINDING_BAND,
                PKMN.Item.BEEDRILLITE
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.POTION,
                PKMN.Item.ORANGE_MAIL,
                PKMN.Item.LAVA_COOKIE,
                PKMN.Item.STARDUST,
                PKMN.Item.SHADOW_MAIL,
                PKMN.Item.PINK_SCARF,
                PKMN.Item.ANTIDOTE,
                PKMN.Item.GREEN_SHARD
            };
            ItemsTestsCommon.TestItemListSettingItems(
                itemPocket,
                validItems
                );
            ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                itemPocket,
                validItems
                );

            Assert.AreEqual(itemPocket.ValidItems.Count, itemPocket.ValidItemNames.Count);
            Assert.Greater(itemPocket.ValidItems.Count, 0);
        }
コード例 #10
0
ファイル: GCNItemsTests.cs プロジェクト: ncorgan/libpkmn
        public static void BerryPocketTest(
            PKMN.ItemList berryPocket,
            PKMN.Game game
            )
        {
            bool colosseum      = (game == PKMN.Game.COLOSSEUM);
            int  expectedLength = 46;

            // Check unchanging and initial values.
            Assert.AreEqual(berryPocket.Name, "Berries");
            Assert.AreEqual(berryPocket.Game, game);
            Assert.AreEqual(berryPocket.Length, expectedLength);
            Assert.AreEqual(berryPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(berryPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                berryPocket,
                PKMN.Item.RAZZ_BERRY
                );

            // Confirm items from other pockets can't be added.
            if (colosseum)
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    berryPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.EIN_FILE_S,
                    PKMN.Item.POTION,
                    PKMN.Item.MASTER_BALL,
                    PKMN.Item.TM01,
                    PKMN.Item.JOY_SCENT
                }
                    );
            }
            else
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    berryPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.GONZAPS_KEY,
                    PKMN.Item.POTION,
                    PKMN.Item.MASTER_BALL,
                    PKMN.Item.TM01,
                    PKMN.Item.JOY_SCENT,
                    PKMN.Item.BATTLE_CD_01
                }
                    );
            }

            // Confirm items from later generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                berryPocket,
                new PKMN.Item[]
            {
                PKMN.Item.BERRY,
                PKMN.Item.OCCA_BERRY,
                PKMN.Item.ROSELI_BERRY
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.CHERI_BERRY,
                PKMN.Item.RAZZ_BERRY,
                PKMN.Item.LUM_BERRY,
                PKMN.Item.PINAP_BERRY,
                PKMN.Item.ASPEAR_BERRY,
                PKMN.Item.IAPAPA_BERRY,
                PKMN.Item.WIKI_BERRY,
                PKMN.Item.APICOT_BERRY
            };
            ItemsTestsCommon.TestItemListSettingItems(
                berryPocket,
                validItems
                );
            ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                berryPocket,
                validItems
                );

            Assert.AreEqual(berryPocket.ValidItems.Count, berryPocket.ValidItemNames.Count);
            Assert.Greater(berryPocket.ValidItems.Count, 0);
        }
コード例 #11
0
ファイル: GCNItemsTests.cs プロジェクト: ncorgan/libpkmn
        public static void TMPocketTest(
            PKMN.ItemList tmPocket,
            PKMN.Game game
            )
        {
            bool colosseum      = (game == PKMN.Game.COLOSSEUM);
            int  expectedLength = 64;

            // Check unchanging and initial values.
            Assert.AreEqual(tmPocket.Name, "TMs");
            Assert.AreEqual(tmPocket.Game, game);
            Assert.AreEqual(tmPocket.Length, expectedLength);
            Assert.AreEqual(tmPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(tmPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                tmPocket,
                PKMN.Item.TM01
                );

            // Confirm items from other pockets can't be added.
            if (colosseum)
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    tmPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.EIN_FILE_S,
                    PKMN.Item.POTION,
                    PKMN.Item.MASTER_BALL,
                    PKMN.Item.ORAN_BERRY,
                    PKMN.Item.JOY_SCENT
                }
                    );
            }
            else
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    tmPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.GONZAPS_KEY,
                    PKMN.Item.POTION,
                    PKMN.Item.MASTER_BALL,
                    PKMN.Item.ORAN_BERRY,
                    PKMN.Item.JOY_SCENT,
                    PKMN.Item.BATTLE_CD_01
                }
                    );
            }

            // Confirm items from later generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                tmPocket,
                new PKMN.Item[]
            {
                PKMN.Item.TM51,
                PKMN.Item.HM01
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.TM01,
                PKMN.Item.TM02,
                PKMN.Item.TM03,
                PKMN.Item.TM04,
                PKMN.Item.TM05,
                PKMN.Item.TM06,
                PKMN.Item.TM07,
                PKMN.Item.TM08
            };
            ItemsTestsCommon.TestItemListSettingItems(
                tmPocket,
                validItems
                );
            ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                tmPocket,
                validItems
                );

            Assert.AreEqual(tmPocket.ValidItems.Count, tmPocket.ValidItemNames.Count);
            Assert.AreEqual(tmPocket.ValidItems.Count, 50);
        }
コード例 #12
0
ファイル: GCNItemsTests.cs プロジェクト: ncorgan/libpkmn
        public static void BallPocketTest(
            PKMN.ItemList ballPocket,
            PKMN.Game game
            )
        {
            bool colosseum      = (game == PKMN.Game.COLOSSEUM);
            int  expectedLength = 16;

            // Check unchanging and initial values.
            Assert.AreEqual(ballPocket.Name, "Poké Balls");
            Assert.AreEqual(ballPocket.Game, game);
            Assert.AreEqual(ballPocket.Length, expectedLength);
            Assert.AreEqual(ballPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(ballPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                ballPocket,
                PKMN.Item.MASTER_BALL
                );

            // Confirm items from other pockets can't be added.
            if (colosseum)
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    ballPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.EIN_FILE_S,
                    PKMN.Item.POTION,
                    PKMN.Item.TM01,
                    PKMN.Item.ORAN_BERRY,
                    PKMN.Item.JOY_SCENT
                }
                    );
            }
            else
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    ballPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.GONZAPS_KEY,
                    PKMN.Item.POTION,
                    PKMN.Item.TM01,
                    PKMN.Item.ORAN_BERRY,
                    PKMN.Item.JOY_SCENT,
                    PKMN.Item.BATTLE_CD_01
                }
                    );
            }

            // Confirm items from later generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                ballPocket,
                new PKMN.Item[]
            {
                PKMN.Item.MOON_BALL,
                PKMN.Item.HEAL_BALL,
                PKMN.Item.DREAM_BALL
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            PKMN.Item[] validItems =
            {
                PKMN.Item.MASTER_BALL,
                PKMN.Item.ULTRA_BALL,
                PKMN.Item.GREAT_BALL,
                PKMN.Item.POKE_BALL,
                PKMN.Item.SAFARI_BALL,
                PKMN.Item.NET_BALL,
                PKMN.Item.DIVE_BALL,
                PKMN.Item.NEST_BALL
            };
            ItemsTestsCommon.TestItemListSettingItems(
                ballPocket,
                validItems
                );
            ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                ballPocket,
                validItems
                );

            Assert.AreEqual(ballPocket.ValidItems.Count, ballPocket.ValidItemNames.Count);
            Assert.Greater(ballPocket.ValidItems.Count, 0);
        }
コード例 #13
0
ファイル: GCNItemsTests.cs プロジェクト: ncorgan/libpkmn
        public static void KeyItemPocketTest(
            PKMN.ItemList keyItemPocket,
            PKMN.Game game
            )
        {
            bool colosseum = (game == PKMN.Game.COLOSSEUM);

            PKMN.Item keyItem        = colosseum ? PKMN.Item.EIN_FILE_S : PKMN.Item.GONZAPS_KEY;
            int       expectedLength = 43;

            // Check unchanging and initial values.
            Assert.AreEqual(keyItemPocket.Name, "Key Items");
            Assert.AreEqual(keyItemPocket.Game, game);
            Assert.AreEqual(keyItemPocket.Length, expectedLength);
            Assert.AreEqual(keyItemPocket.NumItems, 0);

            // Make sure item slots start as correctly empty.
            ItemsTestsCommon.TestItemListEmptySlots(keyItemPocket);

            // Confirm exceptions are thrown when expected.
            ItemsTestsCommon.TestItemListIndexOutOfRangeException(
                keyItemPocket,
                keyItem
                );

            // Confirm items from other pockets can't be added.
            if (colosseum)
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    keyItemPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.POTION,
                    PKMN.Item.GREAT_BALL,
                    PKMN.Item.TM01,
                    PKMN.Item.ORAN_BERRY,
                    PKMN.Item.JOY_SCENT
                }
                    );
            }
            else
            {
                ItemsTestsCommon.TestItemListInvalidItems(
                    keyItemPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.POTION,
                    PKMN.Item.GREAT_BALL,
                    PKMN.Item.TM01,
                    PKMN.Item.ORAN_BERRY,
                    PKMN.Item.JOY_SCENT,
                    PKMN.Item.BATTLE_CD_01
                }
                    );
            }

            // Confirm items from other generations can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                keyItemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.GS_BALL,
                PKMN.Item.POFFIN_CASE,
                PKMN.Item.DNA_SPLICERS,
                PKMN.Item.AQUA_SUIT
            }
                );

            // Confirm items from incompatible Generation III games can't be added.
            ItemsTestsCommon.TestItemListInvalidItems(
                keyItemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.HELIX_FOSSIL,
                PKMN.Item.TEA,
                PKMN.Item.RUBY
            }
                );
            ItemsTestsCommon.TestItemListInvalidItems(
                keyItemPocket,
                new PKMN.Item[]
            {
                PKMN.Item.MAGMA_EMBLEM,
                PKMN.Item.OLD_SEA_MAP
            }
                );

            // Start adding and removing stuff, and make sure the numbers are accurate.
            if (colosseum)
            {
                ItemsTestsCommon.TestItemListSettingItems(
                    keyItemPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.JAIL_KEY,
                    PKMN.Item.ELEVATOR_KEY,
                    PKMN.Item.SMALL_TABLET,
                    PKMN.Item.F_DISK,
                    PKMN.Item.R_DISK,
                    PKMN.Item.L_DISK,
                    PKMN.Item.D_DISK,
                    PKMN.Item.U_DISK
                }
                    );
                ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                    keyItemPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.JAIL_KEY,
                    PKMN.Item.ELEVATOR_KEY,
                    PKMN.Item.SMALL_TABLET,
                    PKMN.Item.F_DISK,
                    PKMN.Item.R_DISK,
                    PKMN.Item.L_DISK,
                    PKMN.Item.D_DISK,
                    PKMN.Item.U_DISK
                }
                    );
            }
            else
            {
                ItemsTestsCommon.TestItemListSettingItems(
                    keyItemPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.KRANE_MEMO_1,
                    PKMN.Item.KRANE_MEMO_2,
                    PKMN.Item.KRANE_MEMO_3,
                    PKMN.Item.KRANE_MEMO_4,
                    PKMN.Item.KRANE_MEMO_5,
                    PKMN.Item.VOICE_CASE_1,
                    PKMN.Item.VOICE_CASE_2,
                    PKMN.Item.VOICE_CASE_3
                }
                    );
                ItemsTestsCommon.TestItemListAddingAndRemovingItems(
                    keyItemPocket,
                    new PKMN.Item[]
                {
                    PKMN.Item.KRANE_MEMO_1,
                    PKMN.Item.KRANE_MEMO_2,
                    PKMN.Item.KRANE_MEMO_3,
                    PKMN.Item.KRANE_MEMO_4,
                    PKMN.Item.KRANE_MEMO_5,
                    PKMN.Item.VOICE_CASE_1,
                    PKMN.Item.VOICE_CASE_2,
                    PKMN.Item.VOICE_CASE_3
                }
                    );
            }

            Assert.AreEqual(keyItemPocket.ValidItems.Count, keyItemPocket.ValidItemNames.Count);
            Assert.Greater(keyItemPocket.ValidItems.Count, 0);
        }