Ejemplo n.º 1
0
        /// <summary>
        /// Apply daily inventory updates to a provided Finest Good
        /// </summary>
        /// <param name="finestGood">The Finest Good to apply inventory updates to</param>
        public void UpdateGood(FinestGood finestGood)
        {
            // Find and use the correct ItemUpdater for finestGood
            switch (finestGood.ItemName.ToLower()) // Allow case inconsistencies
            {
            case "aged brie":
                new AgedBrieItemUpdaterRuleset().ApplyUpdates(finestGood);
                break;

            case "backstage passes":
                new BackstagePassesItemUpdaterRuleset().ApplyUpdates(finestGood);
                break;

            case "sulfuras":
                new SulfurasItemUpdaterRuleset().ApplyUpdates(finestGood);
                break;

            case "normal item":
                new NormalItemUpdaterRuleset().ApplyUpdates(finestGood);
                break;

            case "conjured":
                new ConjuredItemUpdaterRuleset().ApplyUpdates(finestGood);
                break;

            default:
                finestGood.ItemName = "NO SUCH ITEM";     // 2 strikes. See OutFinestGoods.cs note
                break;
            }
        }
Ejemplo n.º 2
0
 // Updates that must be applied last. Default behaviour defined
 protected virtual void ApplyPostUpdates(FinestGood finestGood)
 {
     // 1. Verify minimum Quality
     finestGood.Quality = InventoryManagementRules.GetMinimumAdjustedQuality(finestGood.Quality);
     // 2. Verify Maxium Quality
     finestGood.Quality = InventoryManagementRules.GetMaximumAdjustedQuality(finestGood.Quality);
 }
Ejemplo n.º 3
0
        public List <FinestGood> GetGoods(string goodsFile)
        {
            var rawGoods = File.ReadAllLines(goodsFile);

            var finestGoods = new List <FinestGood>();

            foreach (var rawGood in rawGoods)
            {
                FinestGood finestGood = CreateGood(rawGood);
                finestGoods.Add(finestGood);
            }

            return(finestGoods);
        }
Ejemplo n.º 4
0
        protected override void ApplyGeneralUpdates(FinestGood finestGood)
        {
            var sellInPassed = InventoryManagementRules.HasSellInPassed(finestGood.SellIn);

            finestGood.Quality = InventoryManagementRules.GetDegradedQuality(finestGood.Quality, sellInPassed);
        }
Ejemplo n.º 5
0
 protected override void ApplyPostUpdates(FinestGood finestGood)
 {
     // Sulfuras values are never changed
 }
Ejemplo n.º 6
0
 protected override void ApplyGeneralUpdates(FinestGood finestGood)
 {
     finestGood.Quality = InventoryManagementRules.GetEventQuality(finestGood.Quality, finestGood.SellIn);
 }
Ejemplo n.º 7
0
 protected override void ApplyGeneralUpdates(FinestGood finestGood)
 {
     finestGood.Quality = InventoryManagementRules.GetMaturedQuality(finestGood.Quality);
 }
Ejemplo n.º 8
0
 // Assign item specific rules here
 protected abstract void ApplyGeneralUpdates(FinestGood finestGood);
Ejemplo n.º 9
0
 // Updates that must be applied first. Default behaviour defined
 protected virtual void ApplyPreUpdates(FinestGood finestGood)
 {
     // 1. Daily SellIn Adjustment
     finestGood.SellIn = InventoryManagementRules.GetUpdatedSellIn(finestGood.SellIn);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Apply the updates relating to the ItemUpdaterRuleset
 /// </summary>
 /// <param name="finestGood">The FinestGood to apply updates to</param>
 public virtual void ApplyUpdates(FinestGood finestGood)
 {
     ApplyPreUpdates(finestGood);
     ApplyGeneralUpdates(finestGood);
     ApplyPostUpdates(finestGood);
 }