Commit Graph
8 Commits
Author SHA1 Message Date
Artur GoloyadandClaude Fable 5 26870381a4 refactor: organize updaters into Interfaces/Factories/Strategies
Pure file move + namespace alignment, no logic changes:
- Interfaces/  IItemUpdater, IItemUpdaterFactory (GildedRoseKata.Interfaces)
- Factories/   ItemUpdaterFactory incl. static Default() (GildedRoseKata.Factories)
- Strategies/  ItemUpdaterBase + the 5 concrete updaters (GildedRoseKata.Strategies)

GildedRose.cs changes only in usings; Item.cs and Program.cs untouched.
Full suite 24/24 green; approval snapshot byte-identical.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-26 11:46:39 +02:00
Artur GoloyadandClaude Fable 5 2477b53170 test: re-approve ThirtyDays snapshot with Conjured fix
The only diff vs the previous baseline is the Conjured Mana Cake line
on days 1-4 (now degrading -2 before sell-by and -4 after, floored at
0). All other item types are byte-identical. Full suite: 24/24 green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-25 20:52:03 +02:00
Artur GoloyadandClaude Fable 5 eb87a35411 feat: implement ConjuredItemUpdater
Conjured items degrade twice as fast: -2 before sell-by, -4 after,
never below 0. Registered in ItemUpdaterFactory.Default() and resolved
by the Conjured prefix rule, so the whole Conjured family is covered.

The four Conjured spec tests go green. The ThirtyDays approval snapshot
now shows the intended Conjured-only diff; it is re-approved in the
next commit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-25 20:51:28 +02:00
Artur GoloyadandClaude Fable 5 4074da89e3 refactor: collapse UpdateQuality to delegate to the factory
GildedRose now resolves each item to its strategy and applies it; all
rules live in the strategies. The original one-arg constructor keeps
working by delegating to ItemUpdaterFactory.Default(); a second
constructor allows injecting a custom IItemUpdaterFactory.

No behaviour change: the ThirtyDays approval snapshot and all
existing-type spec tests pass unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-25 20:50:46 +02:00
Artur GoloyadandClaude Fable 5 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
Artur GoloyadandClaude Fable 5 a0066f58cd test: add failing specification tests for Conjured items
Conjured items must degrade twice as fast: -2 before sell-by, -4 after,
never below 0. Red on purpose (TDD) - the legacy code still treats
Conjured as a normal item; they go green once ConjuredItemUpdater lands.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-25 20:49:08 +02:00
Artur GoloyadandClaude Fable 5 ecf3d7e54a test: add specification unit tests for existing item types
Green against the legacy implementation: normal items (-1/-2, floor 0),
Aged Brie (+1/+2, cap 50), Sulfuras (immutable at SellIn 0 and -1),
Backstage passes (+1 / +2 at <=10 / +3 at <=5, 0 after concert, cap 50).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-25 20:48:39 +02:00
Artur GoloyadandClaude Fable 5 93f5e057ed test: approve characterization baseline of current behaviour
Approve the Foo approval snapshot and the pre-existing ThirtyDays
snapshot as the locked-down record of current (Conjured-still-broken)
behaviour. Replace the failing fixme placeholder with a passing
sanity check so the suite is fully green before refactoring.

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