예제 #1
0
 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;
 }
예제 #2
0
        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);
        }
예제 #3
0
 public InventoryService(IQualityCalculator qualityCalculator)
 {
     _qualityCalculator = qualityCalculator;
 }
예제 #4
0
 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);
 }