//[TestMethod()] public void Weapon_Should_Equip_Correctly() { // ARRANGE Character toon = null; InventoryItem invItem = new InventoryItem(); Item item = null; // Get the client's character info string charName = "Badass"; DataLoadOptions dlo = new DataLoadOptions(); dlo.LoadWith<Character>(c => c.Account); dlo.LoadWith<Character>(c => c.Zone); dlo.LoadWith<Character>(c => c.InventoryItems); dlo.LoadWith<InventoryItem>(ii => ii.Item); using (EmuDataContext dbCtx = new EmuDataContext()) { dbCtx.ObjectTrackingEnabled = false; dbCtx.LoadOptions = dlo; toon = dbCtx.Characters.SingleOrDefault(c => c.Name == charName); } ZonePlayer zp = new ZonePlayer(1, toon, 1, new Client(new System.Net.IPEndPoint(0x2414188f, 123))); // Get the inventory item we're giving to the char using (EmuDataContext dbCtx = new EmuDataContext()) { dbCtx.ObjectTrackingEnabled = false; item = dbCtx.Items.SingleOrDefault(i => i.ItemID == 5023); } invItem.Item = item; // ACT zp.AutoGiveItem(ref invItem); // ASSERT }
public void Item_Should_Stack_Correctly_In_A_Container() { // ARRANGE Character toon = null; InventoryItem invItem = new InventoryItem(); Item item = null; // Get the client's character info string charName = "Badass"; DataLoadOptions dlo = new DataLoadOptions(); dlo.LoadWith<Character>(c => c.Account); dlo.LoadWith<Character>(c => c.Zone); dlo.LoadWith<Character>(c => c.InventoryItems); dlo.LoadWith<InventoryItem>(ii => ii.Item); using (EmuDataContext dbCtx = new EmuDataContext()) { dbCtx.ObjectTrackingEnabled = false; dbCtx.LoadOptions = dlo; toon = dbCtx.Characters.SingleOrDefault(c => c.Name == charName); } ZonePlayer zp = new ZonePlayer(1, toon, 1, new Client(new System.Net.IPEndPoint(0x2414188f, 123))); // Get the inventory item (bone chips) we're giving to the char using (EmuDataContext dbCtx = new EmuDataContext()) { dbCtx.ObjectTrackingEnabled = false; item = dbCtx.Items.SingleOrDefault(i => i.ItemID == 13073); } invItem.Item = item; invItem.Charges = 1; // Giving one bone chip // ACT if (!zp.AutoGiveItem(ref invItem)) zp.GiveItem(invItem, (int)InventorySlot.Cursor); }