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 ); }
public static void TMHMPocketTest( PKMN.ItemList tmhmPocket, PKMN.Game game ) { // Check unchanging and initial values. Assert.AreEqual(tmhmPocket.Name, "TM/HM"); Assert.AreEqual(tmhmPocket.Game, game); Assert.AreEqual(tmhmPocket.Length, 57); Assert.AreEqual(tmhmPocket.NumItems, 0); // Make sure item slots start as correctly empty. Assert.AreEqual(tmhmPocket.Length, 57); for (int tmIndex = 1; tmIndex <= 50; ++tmIndex) { PKMN.Item expectedItem = (PKMN.Item.TM01 + (tmIndex - 1)); Assert.AreEqual(tmhmPocket[tmIndex - 1].Item, expectedItem); Assert.AreEqual(tmhmPocket[tmIndex - 1].Amount, 0); } for (int hmIndex = 1; hmIndex <= 7; ++hmIndex) { PKMN.Item expectedItem = (PKMN.Item.HM01 + (hmIndex - 1)); Assert.AreEqual(tmhmPocket[50 + hmIndex - 1].Item, expectedItem); Assert.AreEqual(tmhmPocket[50 + hmIndex - 1].Amount, 0); } // Confirm exceptions are thrown when expected. ItemsTestsCommon.TestItemListIndexOutOfRangeException( tmhmPocket, PKMN.Item.TM10 ); // Confirm items from other pockets can't be added. ItemsTestsCommon.TestItemListInvalidItems( tmhmPocket, new PKMN.Item[] { PKMN.Item.BICYCLE, PKMN.Item.MASTER_BALL, PKMN.Item.BICYCLE } ); // 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. for (int tmIndex = 1; tmIndex <= 50; ++tmIndex) { PKMN.Item item = (PKMN.Item.TM01 + (tmIndex - 1)); tmhmPocket.Add(item, 50); Assert.AreEqual(tmhmPocket.NumItems, tmIndex); Assert.AreEqual(tmhmPocket[tmIndex - 1].Item, item); Assert.AreEqual(tmhmPocket[tmIndex - 1].Amount, 50); } for (int tmIndex = 50; tmIndex >= 1; --tmIndex) { PKMN.Item item = (PKMN.Item.TM01 + (tmIndex - 1)); tmhmPocket.Remove(item, 50); Assert.AreEqual(tmhmPocket.NumItems, tmIndex - 1); Assert.AreEqual(tmhmPocket[tmIndex - 1].Item, item); Assert.AreEqual(tmhmPocket[tmIndex - 1].Amount, 0); } for (int hmIndex = 1; hmIndex <= 7; ++hmIndex) { PKMN.Item item = (PKMN.Item.HM01 + (hmIndex - 1)); tmhmPocket.Add(item, 1); Assert.AreEqual(tmhmPocket.NumItems, hmIndex); Assert.AreEqual(tmhmPocket[50 + hmIndex - 1].Item, item); Assert.AreEqual(tmhmPocket[50 + hmIndex - 1].Amount, 1); } for (int hmIndex = 7; hmIndex >= 1; --hmIndex) { PKMN.Item item = (PKMN.Item.HM01 + (hmIndex - 1)); tmhmPocket.Remove(item, 1); Assert.AreEqual(tmhmPocket.NumItems, hmIndex - 1); Assert.AreEqual(tmhmPocket[50 + hmIndex - 1].Item, item); Assert.AreEqual(tmhmPocket[50 + hmIndex - 1].Amount, 0); } Assert.AreEqual(tmhmPocket.ValidItems.Count, tmhmPocket.ValidItemNames.Count); Assert.AreEqual(tmhmPocket.ValidItems.Count, 57); }
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); }
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); }
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); }
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); }
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 ); }
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); }
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); }
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); }
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); }
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); }