public void ConsumeProduct_AddsProvide() { const int amount = 100; _reserve.SetAmount(ProductId, amount); var status = _reserve.GetProductStatus(ProductId); var before = _reserve.GetConsumeProducts().FirstOrDefault(i => i.ProductId == ProductId); _reserve.SetConsume(ProductId, true); var after = _reserve.GetConsumeProducts().FirstOrDefault(i => i.ProductId == ProductId); Assert.IsNotNull(status); Assert.IsTrue(status.ShouldConsume); Assert.IsFalse(status.ShouldProvide); Assert.IsNull(before); Assert.IsNotNull(after); Assert.AreEqual(amount, after.Amount); }
private void HandleAmountChanged(float amount) { _reserve.SetAmount(_productId, (int)amount); }