mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 14:31:28 +00:00
30 lines
642 B
C#
30 lines
642 B
C#
using System;
|
|
|
|
namespace csharp.StrategyPatternExample.Strategy
|
|
{
|
|
/// <summary>
|
|
/// Implements the strategy; Increase in Quality the older it gets.
|
|
/// </summary>
|
|
internal class OlderIsBetterStrategy : ICategoryStrategy
|
|
{
|
|
#region Methods
|
|
|
|
public void Update(Item item)
|
|
{
|
|
if (item.Quality < Global.MAXIMUM_QUALITY)
|
|
{
|
|
item.Quality++;
|
|
}
|
|
|
|
item.SellIn--;
|
|
|
|
if (item.SellIn < 0 && item.Quality < Global.MAXIMUM_QUALITY)
|
|
{
|
|
item.Quality++;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|