mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 06:21:29 +00:00
31 lines
872 B
C#
31 lines
872 B
C#
namespace GildedRoseKata;
|
|
|
|
public static class DailyUpdaterFactory
|
|
{
|
|
public static DailyUpdater GetDailyUpdater(Item item)
|
|
{
|
|
if (IsLegendaryItem(item))
|
|
{
|
|
return new DailyUpdaterForLegendaryItems();
|
|
}
|
|
|
|
if (IsBetterWithAgeItem(item))
|
|
{
|
|
return new DailyUpdaterForBetterWithAgeItems();
|
|
}
|
|
|
|
if (IsBackstagePassesItem(item))
|
|
{
|
|
return new DailyUpdaterForBackstagePassesItems();
|
|
}
|
|
|
|
return new DailyUpdaterForRegularItems();
|
|
}
|
|
|
|
private static bool IsLegendaryItem(Item item) => item.Name.ToLower().Contains("sulfuras");
|
|
|
|
private static bool IsBackstagePassesItem(Item item) => item.Name.ToLower().Contains("backstage passes");
|
|
|
|
private static bool IsBetterWithAgeItem(Item item) => item.Name.ToLower().Equals("aged brie");
|
|
|
|
} |