public void Transform(StockItem item) { int qualitymod = theRate; if (item.SellIn < 0) { qualitymod *= 2; } item.SellIn -= 1; item.Quality.Value = StockQuality.Constrain(item.Quality.Value - qualitymod); }
public void Transform(StockItem item) { if (item.SellIn < 0) { item.Quality.Value = StockQuality.MinValue; } else if (item.SellIn > 5 && item.SellIn <= 10) { item.Quality.Value = StockQuality.Constrain(item.Quality.Value + 2); } else if (item.SellIn >= 0 && item.SellIn <= 5) { item.Quality.Value = StockQuality.Constrain(item.Quality.Value + 3); } else { item.Quality.Value = StockQuality.Constrain(item.Quality.Value + 1); } item.SellIn--; }