GildedRose-Refactoring-Kata/csharp.xUnit/GildedRose/AgedBrieUpdater.cs
Artur Goloyad 8965637f18 refactor: add IItemUpdater strategies and ItemUpdaterFactory
Introduce the Strategy + Factory design: IItemUpdater (Name + Update),
an ItemUpdaterBase with the single shared [0,50] clamp helper, stateless
strategies for normal/Aged Brie/Sulfuras/Backstage, and a factory with
two-tier resolution (exact name via case-insensitive dictionary, then
Conjured prefix rule, then the default fallback).

Not wired into GildedRose yet; no behaviour change. The Conjured
strategy itself arrives in the feature commit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-25 20:50:18 +02:00

17 lines
371 B
C#

namespace GildedRoseKata;
public class AgedBrieUpdater : ItemUpdaterBase
{
public override string Name => "Aged Brie";
public override void Update(Item item)
{
item.Quality = ClampQuality(item.Quality + 1);
item.SellIn -= 1;
if (item.SellIn < 0)
{
item.Quality = ClampQuality(item.Quality + 1);
}
}
}