GildedRose-Refactoring-Kata/csharpcore/GildedRose/LegendaryItemBuilder.cs
Sarah Ashri d076fc9ba4 Add ItemBuilders hierarchy to enforce building valid items
Also updated unit tests:
- Added unit tests for the new ItemBuilders classes
- Refactored existing tests to use the new builders
2024-03-15 11:46:55 +10:00

17 lines
415 B
C#

using System;
namespace GildedRoseKata;
public class LegendaryItemBuilder(string name, int sellIn)
: AbstractItemBuilder(name, sellIn, ItemQuality.LegendaryItemQuality)
{
public override Item Build()
{
if (!ItemType.IsLegendaryItem(Name))
{
throw new ArgumentException("Only Legendary items can be built using this builder");
}
return base.Build();
}
}