public bool IsSameAs(IUIItem other) { /* Ghost is treated as same, sharing the same item instance with picked */ if (thisItemTemp.IsStackable()) { return(thisItemTemp == other.GetItemTemplate()); } else /* non stackable */ { return(thisItemID == other.GetItemID()); } }
public void IsSameAs_ThisItemTempIsNotStackable_ThisItemIDEqualsToOtherItemID_ReturnsTrue() { IUIItemConstArg arg; const int itemID = 0; TestItem item = CreateTestItem(1, itemID, out arg); IItemTemplate thisItemTemp = arg.itemTemp; thisItemTemp.IsStackable().Returns(false); IUIItem otherItem = Substitute.For <IUIItem>(); otherItem.GetItemID().Returns(itemID); bool actualBool = item.IsSameAs(otherItem); Assert.That(actualBool, Is.True); }