public StockItem(string name, int sellInValue, uint quality, IQualityCalculator qualityCalculator, bool canDegradeByDate) { Name = name.Equals("INVALID ITEM") ? "NO SUCH ITEM" : name; SellInValue = sellInValue; Quality = quality; QualityCalculator = qualityCalculator; CanDegradeByDate = canDegradeByDate; }
public void AddStock(string name, int sellInValue, uint quality, IQualityCalculator qualityCalculator, bool canDegradeByDate = true) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException(nameof(name)); } var item = new StockItem(name, sellInValue, quality, qualityCalculator, canDegradeByDate); InventoryItems.Add(item); }
public InventoryService(IQualityCalculator qualityCalculator) { _qualityCalculator = qualityCalculator; }
private static void addToInventory(string name, int sellInValue, uint quality, IQualityCalculator qualityCalculator, bool canDegradeByDate = true) { Console.WriteLine($"Adding {name} {sellInValue} {quality}"); _inventory.AddStock(name, sellInValue, quality, qualityCalculator, canDegradeByDate); }