示例#1
0
        public static void ItemBagTest(
            PKMN.ItemBag itemBag,
            PKMN.Game game
            )
        {
            // Check unchanging and initial values.
            Assert.AreEqual(itemBag.Game, game);
            Assert.AreEqual(itemBag.Count, 1);

            // Confirm items from later generations can't be added.
            ItemsTestsCommon.TestItemBagInvalidItems(
                itemBag,
                WrongGenerationItems
                );

            ItemListTest(itemBag["Items"], game);

            // Make sure adding items through the bag adds to the pocket.
            PKMN.ItemList itemPocket = itemBag["Items"];
            Assert.AreEqual(itemPocket.NumItems, 0);

            for (int i = 0; i < 8; ++i)
            {
                itemBag.Add(
                    Items[i],
                    i + 1
                    );
            }
            for (int i = 0; i < 8; ++i)
            {
                Assert.AreEqual(itemPocket[i].Item, Items[i]);
                Assert.AreEqual(itemPocket[i].Amount, i + 1);
            }
            Assert.AreEqual(itemPocket[8].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemPocket[8].Amount, 0);

            for (int i = 0; i < 8; ++i)
            {
                itemBag.Remove(
                    Items[i],
                    i + 1
                    );
            }
            for (int i = 0; i < 9; ++i)
            {
                Assert.AreEqual(itemPocket[i].Item, PKMN.Item.NONE);
                Assert.AreEqual(itemPocket[i].Amount, 0);
            }
        }
示例#2
0
 public static void TestItemBagInvalidItems(
     PKMN.ItemBag itemBag,
     PKMN.Item[] items
     )
 {
     foreach (PKMN.Item item in items)
     {
         Assert.Throws <ArgumentOutOfRangeException>(
             delegate
         {
             itemBag.Add(item, 1);
         }
             );
     }
 }
示例#3
0
        public static void ItemBagTest(
            PKMN.ItemBag itemBag,
            PKMN.Game game
            )
        {
            string tmhmPocketName  = "";
            string berryPocketName = "";

            if ((game == PKMN.Game.FIRERED) || (game == PKMN.Game.LEAFGREEN))
            {
                tmhmPocketName  = "TM Case";
                berryPocketName = "Berry Pouch";
            }
            else
            {
                tmhmPocketName  = "TMs & HMs";
                berryPocketName = "Berries";
            }

            // Check unchanging and initial values.
            Assert.AreEqual(itemBag.Game, game);
            Assert.AreEqual(itemBag.Count, 5);

            ItemPocketTest(itemBag["Items"], game);
            KeyItemPocketTest(itemBag["Key Items"], game);
            BallPocketTest(itemBag["Poké Balls"], game);
            TMHMPocketTest(itemBag[tmhmPocketName], game);
            BerryPocketTest(itemBag[berryPocketName], game);

            // Make sure adding items through the bag adds to the proper pockets.
            Assert.AreEqual(itemBag["Items"].NumItems, 0);
            Assert.AreEqual(itemBag["Key Items"].NumItems, 0);
            Assert.AreEqual(itemBag["Poké Balls"].NumItems, 0);
            Assert.AreEqual(itemBag[tmhmPocketName].NumItems, 0);
            Assert.AreEqual(itemBag[berryPocketName].NumItems, 0);
            foreach (PKMN.Item item in AllPocketItems)
            {
                itemBag.Add(item, 5);
            }

            Assert.AreEqual(itemBag["Items"][0].Item, PKMN.Item.POTION);
            Assert.AreEqual(itemBag["Items"][0].Amount, 5);
            Assert.AreEqual(itemBag["Items"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Items"][1].Amount, 0);

            Assert.AreEqual(itemBag["Key Items"][0].Item, PKMN.Item.MACH_BIKE);
            Assert.AreEqual(itemBag["Key Items"][0].Amount, 5);
            Assert.AreEqual(itemBag["Key Items"][1].Item, PKMN.Item.WAILMER_PAIL);
            Assert.AreEqual(itemBag["Key Items"][1].Amount, 5);
            Assert.AreEqual(itemBag["Key Items"][2].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Key Items"][2].Amount, 0);

            Assert.AreEqual(itemBag["Poké Balls"][0].Item, PKMN.Item.GREAT_BALL);
            Assert.AreEqual(itemBag["Poké Balls"][0].Amount, 5);
            Assert.AreEqual(itemBag["Poké Balls"][1].Item, PKMN.Item.MASTER_BALL);
            Assert.AreEqual(itemBag["Poké Balls"][1].Amount, 5);
            Assert.AreEqual(itemBag["Poké Balls"][2].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Poké Balls"][2].Amount, 0);

            Assert.AreEqual(itemBag[tmhmPocketName][0].Item, PKMN.Item.TM01);
            Assert.AreEqual(itemBag[tmhmPocketName][0].Amount, 5);
            Assert.AreEqual(itemBag[tmhmPocketName][1].Item, PKMN.Item.HM04);
            Assert.AreEqual(itemBag[tmhmPocketName][1].Amount, 5);
            Assert.AreEqual(itemBag[tmhmPocketName][2].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag[tmhmPocketName][2].Amount, 0);

            Assert.AreEqual(itemBag[berryPocketName][0].Item, PKMN.Item.ASPEAR_BERRY);
            Assert.AreEqual(itemBag[berryPocketName][0].Amount, 5);
            Assert.AreEqual(itemBag[berryPocketName][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag[berryPocketName][1].Amount, 0);

            // Make sure removing items through the bag removes from the proper pockets.
            foreach (PKMN.Item item in AllPocketItems)
            {
                itemBag.Remove(item, 5);
            }

            Assert.AreEqual(itemBag["Items"][0].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Items"][0].Amount, 0);
            Assert.AreEqual(itemBag["Items"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Items"][1].Amount, 0);

            Assert.AreEqual(itemBag["Key Items"][0].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Key Items"][0].Amount, 0);
            Assert.AreEqual(itemBag["Key Items"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Key Items"][1].Amount, 0);
            Assert.AreEqual(itemBag["Key Items"][2].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Key Items"][2].Amount, 0);

            Assert.AreEqual(itemBag["Poké Balls"][0].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Poké Balls"][0].Amount, 0);
            Assert.AreEqual(itemBag["Poké Balls"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Poké Balls"][1].Amount, 0);
            Assert.AreEqual(itemBag["Poké Balls"][2].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Poké Balls"][2].Amount, 0);

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

            Assert.AreEqual(itemBag[berryPocketName][0].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag[berryPocketName][0].Amount, 0);
            Assert.AreEqual(itemBag[berryPocketName][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag[berryPocketName][1].Amount, 0);

            ItemsTestsCommon.TestItemBagInvalidItems(
                itemBag,
                WrongGameAllPocketItems
                );
        }
示例#4
0
        public static void ItemBagTest(
            PKMN.ItemBag itemBag,
            PKMN.Game game
            )
        {
            // Check unchanging and initial values.
            Assert.AreEqual(itemBag.Game, game);
            Assert.AreEqual(itemBag.Count, 4);

            ItemPocketTest(itemBag["Items"], game);
            KeyItemPocketTest(itemBag["KeyItems"], game);
            BallPocketTest(itemBag["Balls"], game);
            TMHMPocketTest(itemBag["TM/HM"], game);

            // Make sure adding items through the bag adds to the proper pockets.
            Assert.AreEqual(itemBag["Items"].NumItems, 0);
            Assert.AreEqual(itemBag["KeyItems"].NumItems, 0);
            Assert.AreEqual(itemBag["Balls"].NumItems, 0);
            Assert.AreEqual(itemBag["TM/HM"].NumItems, 0);
            foreach (PKMN.Item item in AllPocketItems)
            {
                itemBag.Add(item, 1);
            }

            Assert.AreEqual(itemBag["Items"][0].Item, PKMN.Item.POTION);
            Assert.AreEqual(itemBag["Items"][0].Amount, 1);
            Assert.AreEqual(itemBag["Items"][1].Item, PKMN.Item.BERRY);
            Assert.AreEqual(itemBag["Items"][1].Amount, 1);
            Assert.AreEqual(itemBag["Items"][2].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Items"][2].Amount, 0);

            Assert.AreEqual(itemBag["KeyItems"][0].Item, PKMN.Item.BICYCLE);
            Assert.AreEqual(itemBag["KeyItems"][0].Amount, 1);
            Assert.AreEqual(itemBag["KeyItems"][1].Item, PKMN.Item.SQUIRT_BOTTLE);
            Assert.AreEqual(itemBag["KeyItems"][1].Amount, 1);
            Assert.AreEqual(itemBag["KeyItems"][2].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["KeyItems"][2].Amount, 0);

            Assert.AreEqual(itemBag["Balls"][0].Item, PKMN.Item.GREAT_BALL);
            Assert.AreEqual(itemBag["Balls"][0].Amount, 1);
            Assert.AreEqual(itemBag["Balls"][1].Item, PKMN.Item.FRIEND_BALL);
            Assert.AreEqual(itemBag["Balls"][1].Amount, 1);
            Assert.AreEqual(itemBag["Balls"][2].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Balls"][2].Amount, 0);

            Assert.AreEqual(itemBag["TM/HM"][0].Item, PKMN.Item.TM01);
            Assert.AreEqual(itemBag["TM/HM"][0].Amount, 0);
            Assert.AreEqual(itemBag["TM/HM"][1].Item, PKMN.Item.TM02);
            Assert.AreEqual(itemBag["TM/HM"][1].Amount, 0);
            Assert.AreEqual(itemBag["TM/HM"][27].Item, PKMN.Item.TM28);
            Assert.AreEqual(itemBag["TM/HM"][27].Amount, 1);
            Assert.AreEqual(itemBag["TM/HM"][50].Item, PKMN.Item.HM01);
            Assert.AreEqual(itemBag["TM/HM"][50].Amount, 1);

            // Make sure removing items through the bag removes from the proper pockets.
            foreach (PKMN.Item item in AllPocketItems)
            {
                itemBag.Remove(item, 1);
            }

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

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

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

            Assert.AreEqual(itemBag["TM/HM"][0].Item, PKMN.Item.TM01);
            Assert.AreEqual(itemBag["TM/HM"][0].Amount, 0);
            Assert.AreEqual(itemBag["TM/HM"][1].Item, PKMN.Item.TM02);
            Assert.AreEqual(itemBag["TM/HM"][1].Amount, 0);
            Assert.AreEqual(itemBag["TM/HM"][27].Item, PKMN.Item.TM28);
            Assert.AreEqual(itemBag["TM/HM"][27].Amount, 0);
            Assert.AreEqual(itemBag["TM/HM"][50].Item, PKMN.Item.HM01);
            Assert.AreEqual(itemBag["TM/HM"][50].Amount, 0);

            // Make sure we can't add Crystal-specific items with a Gold/Silver bag.
            if (game == PKMN.Game.CRYSTAL)
            {
                for (int i = 0; i < CrystalItems.Length; ++i)
                {
                    itemBag.Add(CrystalItems[i], 1);
                    Assert.AreEqual(itemBag["KeyItems"][i].Item, CrystalItems[i]);
                    Assert.AreEqual(itemBag["KeyItems"][i].Amount, 1);
                }
                for (int i = CrystalItems.Length - 1; i >= 0; --i)
                {
                    itemBag.Remove(CrystalItems[i], 1);
                    Assert.AreEqual(itemBag["KeyItems"][i].Item, PKMN.Item.NONE);
                    Assert.AreEqual(itemBag["KeyItems"][i].Amount, 0);
                }
            }
            else
            {
                ItemsTestsCommon.TestItemBagInvalidItems(
                    itemBag,
                    CrystalItems
                    );
            }

            // Make sure we can't add items from later generations.
            ItemsTestsCommon.TestItemBagInvalidItems(
                itemBag,
                WrongGenerationAllPocketItems
                );
        }
示例#5
0
        public static void ItemBagTest(
            PKMN.ItemBag itemBag,
            PKMN.Game game
            )
        {
            bool colosseum = (game == PKMN.Game.COLOSSEUM);

            PKMN.Item keyItem = colosseum ? PKMN.Item.EIN_FILE_S : PKMN.Item.GONZAPS_KEY;

            // Check unchanging and initial values.
            Assert.AreEqual(itemBag.Game, game);
            Assert.AreEqual(itemBag.Count, (colosseum ? 6 : 7));

            ItemPocketTest(itemBag["Items"], game);
            KeyItemPocketTest(itemBag["Key Items"], game);
            BallPocketTest(itemBag["Poké Balls"], game);
            TMPocketTest(itemBag["TMs"], game);
            BerryPocketTest(itemBag["Berries"], game);
            ColognePocketTest(itemBag["Colognes"], game);
            if (!colosseum)
            {
                BattleCDPocketTest(itemBag["Battle CDs"], game);
            }

            // Make sure adding items through the bag adds to the proper pockets.
            Assert.AreEqual(itemBag["Items"].NumItems, 0);
            Assert.AreEqual(itemBag["Key Items"].NumItems, 0);
            Assert.AreEqual(itemBag["Poké Balls"].NumItems, 0);
            Assert.AreEqual(itemBag["TMs"].NumItems, 0);
            Assert.AreEqual(itemBag["Berries"].NumItems, 0);
            Assert.AreEqual(itemBag["Colognes"].NumItems, 0);
            if (!colosseum)
            {
                Assert.AreEqual(itemBag["Battle CDs"].NumItems, 0);
            }
            foreach (PKMN.Item item in (colosseum ? ColosseumAllPocketItems : XDAllPocketItems))
            {
                itemBag.Add(item, 5);
            }

            Assert.AreEqual(itemBag["Items"][0].Item, PKMN.Item.POTION);
            Assert.AreEqual(itemBag["Items"][0].Amount, 5);
            Assert.AreEqual(itemBag["Items"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Items"][1].Amount, 0);

            Assert.AreEqual(itemBag["Key Items"][0].Item, keyItem);
            Assert.AreEqual(itemBag["Key Items"][0].Amount, 5);
            Assert.AreEqual(itemBag["Key Items"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Key Items"][1].Amount, 0);

            Assert.AreEqual(itemBag["Poké Balls"][0].Item, PKMN.Item.GREAT_BALL);
            Assert.AreEqual(itemBag["Poké Balls"][0].Amount, 5);
            Assert.AreEqual(itemBag["Poké Balls"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Poké Balls"][1].Amount, 0);

            Assert.AreEqual(itemBag["TMs"][0].Item, PKMN.Item.TM01);
            Assert.AreEqual(itemBag["TMs"][0].Amount, 5);
            Assert.AreEqual(itemBag["TMs"][1].Item, PKMN.Item.TM02);
            Assert.AreEqual(itemBag["TMs"][1].Amount, 5);
            Assert.AreEqual(itemBag["TMs"][2].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["TMs"][2].Amount, 0);

            Assert.AreEqual(itemBag["Berries"][0].Item, PKMN.Item.ASPEAR_BERRY);
            Assert.AreEqual(itemBag["Berries"][0].Amount, 5);
            Assert.AreEqual(itemBag["Berries"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Berries"][1].Amount, 0);

            Assert.AreEqual(itemBag["Colognes"][0].Item, PKMN.Item.JOY_SCENT);
            Assert.AreEqual(itemBag["Colognes"][0].Amount, 5);

            if (colosseum)
            {
                Assert.AreEqual(itemBag["Colognes"][1].Item, PKMN.Item.EXCITE_SCENT);
                Assert.AreEqual(itemBag["Colognes"][1].Amount, 5);
                Assert.AreEqual(itemBag["Colognes"][2].Item, PKMN.Item.NONE);
                Assert.AreEqual(itemBag["Colognes"][2].Amount, 0);
            }
            else
            {
                Assert.AreEqual(itemBag["Colognes"][1].Item, PKMN.Item.NONE);
                Assert.AreEqual(itemBag["Colognes"][1].Amount, 0);

                Assert.AreEqual(itemBag["Battle CDs"][0].Item, PKMN.Item.BATTLE_CD_01);
                Assert.AreEqual(itemBag["Battle CDs"][0].Amount, 5);
            }

            // Make sure removing items through the bag removes from the proper pockets.
            foreach (PKMN.Item item in (colosseum ? ColosseumAllPocketItems : XDAllPocketItems))
            {
                itemBag.Remove(item, 5);
            }

            Assert.AreEqual(itemBag["Items"][0].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Items"][0].Amount, 0);
            Assert.AreEqual(itemBag["Items"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Items"][1].Amount, 0);

            Assert.AreEqual(itemBag["Key Items"][0].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Key Items"][0].Amount, 0);
            Assert.AreEqual(itemBag["Key Items"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Key Items"][1].Amount, 0);

            Assert.AreEqual(itemBag["Poké Balls"][0].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Poké Balls"][0].Amount, 0);
            Assert.AreEqual(itemBag["Poké Balls"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Poké Balls"][1].Amount, 0);

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

            Assert.AreEqual(itemBag["Berries"][0].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Berries"][0].Amount, 0);
            Assert.AreEqual(itemBag["Berries"][1].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Berries"][1].Amount, 0);

            Assert.AreEqual(itemBag["Colognes"][0].Item, PKMN.Item.NONE);
            Assert.AreEqual(itemBag["Colognes"][0].Amount, 0);

            if (colosseum)
            {
                Assert.AreEqual(itemBag["Colognes"][1].Item, PKMN.Item.NONE);
                Assert.AreEqual(itemBag["Colognes"][1].Amount, 0);
                Assert.AreEqual(itemBag["Colognes"][2].Item, PKMN.Item.NONE);
                Assert.AreEqual(itemBag["Colognes"][2].Amount, 0);
            }
            else
            {
                Assert.AreEqual(itemBag["Colognes"][1].Item, PKMN.Item.NONE);
                Assert.AreEqual(itemBag["Colognes"][1].Amount, 0);

                Assert.AreEqual(itemBag["Battle CDs"][0].Item, PKMN.Item.NONE);
                Assert.AreEqual(itemBag["Battle CDs"][0].Amount, 0);
            }

            ItemsTestsCommon.TestItemBagInvalidItems(
                itemBag,
                colosseum ? ColosseumWrongGameAllPocketItems : XDWrongGameAllPocketItems
                );
        }