public void player_should_drop_all_items() { var player = new PlayerBuilder() .With(p => p.Id, 50) .BuildAndSave(); var runeItem = new ItemBuilder() .With(i => i.Id, 1) .With(i => i.IsEquipped, false) .With(i => i.Owner, player) .With(i => i.ItemSource, new ItemSourceBuilder() .With(i => i.ItemType, PvPStatics.ItemType_Rune) .BuildAndSave() ) .BuildAndSave(); var nonRuneItem = new ItemBuilder() .With(i => i.Id, 2) .With(i => i.IsEquipped, false) .With(i => i.Owner, player) .With(i => i.ItemSource, new ItemSourceBuilder() .With(i => i.ItemType, PvPStatics.ItemType_Hat) .BuildAndSave() ) .BuildAndSave(); var embeddedRune = new ItemBuilder() .With(i => i.Id, 3) .With(i => i.IsEquipped, false) .With(i => i.Owner, player) .With(i => i.ItemSource, new ItemSourceBuilder() .With(i => i.ItemType, PvPStatics.ItemType_Rune) .BuildAndSave() ) .With(i => i.EmbeddedOnItem, nonRuneItem) .BuildAndSave(); nonRuneItem.AttachRune(embeddedRune); player.Items.Add(runeItem); player.Items.Add(nonRuneItem); player.DropAllItems(); Assert.That(runeItem.Owner, Is.Null); Assert.That(runeItem.IsEquipped, Is.False); Assert.That(runeItem.dbLocationName, Is.EqualTo("street_70e9th")); Assert.That(nonRuneItem.Owner, Is.Null); Assert.That(nonRuneItem.IsEquipped, Is.False); Assert.That(nonRuneItem.dbLocationName, Is.EqualTo("street_70e9th")); Assert.That(embeddedRune.Owner, Is.Null); Assert.That(embeddedRune.dbLocationName, Is.Empty); Assert.That(embeddedRune.EmbeddedOnItem, Is.EqualTo(nonRuneItem)); }
public void player_should_drop_all_items_ignoring_runes() { var player = new PlayerBuilder() .With(p => p.Id, 50) .BuildAndSave(); var runeItem = new ItemBuilder() .With(i => i.Id, 1) .With(i => i.Owner.Id, 50) .With(i => i.IsEquipped, true) .With(i => i.Owner, player) .With(i => i.ItemSource, new ItemSourceBuilder() .With(i => i.ItemType, PvPStatics.ItemType_Rune) .BuildAndSave() ) .BuildAndSave(); var nonRuneItem = new ItemBuilder() .With(i => i.Id, 2) .With(i => i.Owner.Id, 50) .With(i => i.IsEquipped, false) .With(i => i.Owner, player) .With(i => i.ItemSource, new ItemSourceBuilder() .With(i => i.ItemType, PvPStatics.ItemType_Hat) .BuildAndSave() ) .BuildAndSave(); player.Items.Add(runeItem); player.Items.Add(nonRuneItem); player.DropAllItems(true); Assert.That(runeItem.Owner.Id, Is.EqualTo(player.Id)); Assert.That(runeItem.IsEquipped, Is.True); Assert.That(runeItem.dbLocationName, Is.Null); Assert.That(nonRuneItem.Owner, Is.Null); Assert.That(nonRuneItem.IsEquipped, Is.False); Assert.That(nonRuneItem.dbLocationName, Is.EqualTo("street_70e9th")); }