GildedRose-Refactoring-Kata/csharp/StrategyPatternExample/Strategies/NormalDegradeStrategy.cs
israel f6db7aa935 · Insert comments.
· DoNothingStrategy created.
2017-10-20 13:14:29 +01:00

31 lines
684 B
C#

using System;
namespace csharp.StrategyPatternExample.Strategy
{
/// <summary>
/// Implements the strategy; SellIn and Quality values are lowered.
/// Main strategy for the most items.
/// </summary>
internal class NormalDegradeStrategy : ICategoryStrategy
{
#region Methods
public void Update(Item item)
{
if (item.Quality > Global.MINIMUM_QUALITY)
{
item.Quality--;
}
item.SellIn--;
if (item.SellIn < 0 && item.Quality > Global.MINIMUM_QUALITY)
{
item.Quality--;
}
}
#endregion
}
}