public void UnEquipFullRestoreCollectionTest() { var clone = (IEquippableItemInstance)_headItem.Clone(); _restoreToCollection.Add(_headItem, _headItem.maxStackSize * _restoreToCollection.slotCount); // Fill collection var canAdd = _restoreToCollection.CanAdd((IEquippableItemInstance)_headItem.Clone(), 1); var equipped = _equippableCharacter.Equip(clone, 1); var unEquipped = _equippableCharacter.UnEquip(clone); Assert.AreEqual(Errors.CollectionFull, canAdd.error); Assert.IsNull(equipped.error); Assert.AreEqual(Errors.CollectionFull, unEquipped.error); Assert.AreEqual(_equipmentCollection, clone.collectionEntry?.collection); Assert.AreEqual(_headItem, _equipmentCollection[0]); Assert.AreEqual(1, _equipmentCollection.GetAmount(0)); }
public void AddStackableArrowsTest3() { _restoreToCollection.Add(_arrowsItem, 100); var item2 = (MockedEquippableItemInstance)_arrowsItem.Clone(); var item3 = (MockedEquippableItemInstance)_arrowsItem.Clone(); var added1 = _equippableCharacter.Equip(_arrowsItem); var added2 = _equippableCharacter.Equip(item2); var added3 = _equippableCharacter.Equip(item3); var unEquipped = _equippableCharacter.UnEquip(_arrowsItem, 3); Assert.IsNull(added1.error); Assert.IsNull(added2.error); Assert.IsNull(added3.error); Assert.IsNull(unEquipped.error); // Arrows should've been unequipped by ForceAdd action. Assert.AreEqual(0, _equipmentCollection.GetAmount(_arrowsItem)); Assert.AreEqual(0, _equipmentCollection.GetAmount(4)); Assert.AreEqual(100, _restoreToCollection.GetAmount(_arrowsItem)); }