mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-14 22:21:20 +00:00
27 lines
753 B
C#
27 lines
753 B
C#
using System.Collections.Generic;
|
|
|
|
namespace GildedRoseKata;
|
|
|
|
public class GildedRose
|
|
{
|
|
private readonly IList<Item> _items;
|
|
private DailyUpdaterFactory _dailyUpdaterFactory;
|
|
|
|
public GildedRose(IList<Item> items)
|
|
{
|
|
_items = items;
|
|
// The DailyUpdaterFactory should have been injected through the constructor.
|
|
// However, this will require changing the supporting tests which we don't want to do at this stage.
|
|
_dailyUpdaterFactory = new DailyUpdaterFactory();
|
|
}
|
|
|
|
public void UpdateQuality()
|
|
{
|
|
foreach (var item in _items)
|
|
{
|
|
DailyUpdater dailyUpdater = _dailyUpdaterFactory.GetDailyUpdater(item);
|
|
dailyUpdater.DailyUpdate(item);
|
|
}
|
|
}
|
|
|
|
} |