public void Compress_StacksItemsToSaveSlots() { _inv.TotalSlots = 4; var itemA = Substitute.For <IItemInfo>(); itemA.ID = 42; itemA.SlotsRequired = 1; itemA.StackSize = 40; var itemB = Substitute.For <IItemInfo>(); itemB.ID = 1337; itemB.SlotsRequired = 2; itemB.StackSize = 3; _inv.Clear(); for (int i = 0; i < 3; i++) { _inv.Store(itemA, 20); } _inv.Retrieve(itemA, 20); int preAmount = _inv.GetAmount(itemA); _inv.Compress(); Assert.AreEqual(preAmount, _inv.GetAmount(itemA)); Assert.AreEqual(1, _inv.UsedSlots); _inv.Clear(); for (int i = 0; i < 5; i++) { _inv.Store(itemB, 1); } _inv.Retrieve(itemB, 2); preAmount = _inv.GetAmount(itemB); _inv.Compress(); Assert.AreEqual(preAmount, _inv.GetAmount(itemB)); Assert.AreEqual(2, _inv.UsedSlots); }