mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
31 lines
684 B
C#
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
|
|
}
|
|
}
|