GildedRose-Refactoring-Kata/csharp.xUnit/GildedRose/ItemUpdaterBase.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

16 lines
361 B
C#

using System;
namespace GildedRoseKata;
public abstract class ItemUpdaterBase : IItemUpdater
{
public const int MinQuality = 0;
public const int MaxQuality = 50;
public abstract string Name { get; }
public abstract void Update(Item item);
protected static int ClampQuality(int quality) => Math.Clamp(quality, MinQuality, MaxQuality);
}