mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 06:21:29 +00:00
Adding code to handle the Conjured Items
This commit is contained in:
parent
03d18cbc16
commit
eeb9a00ce7
@ -14,6 +14,7 @@ namespace csharpcore
|
||||
public const string SULFURA_ITEM = "sulfura";
|
||||
public const string AGED_BRIE_ITEM = "aged brie";
|
||||
public const string BACKSTAGE_PASS_ITEM = "backstage pass";
|
||||
public const string CONJURED_ITEM = "conjured";
|
||||
|
||||
|
||||
IList<Item> Items;
|
||||
@ -41,6 +42,10 @@ namespace csharpcore
|
||||
{
|
||||
HandleBackstagePassItem(item);
|
||||
}
|
||||
else if (lowerCaseItemName.Contains(CONJURED_ITEM))
|
||||
{
|
||||
HandleConjuredItem(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
HandleMiscelaniousItem(item);
|
||||
@ -80,6 +85,15 @@ namespace csharpcore
|
||||
item.Quality = MIN_QUALITY;
|
||||
}
|
||||
|
||||
private void HandleConjuredItem(Item item)
|
||||
{
|
||||
if (item.SellIn > 0)
|
||||
UpdateItemQualityValue(item, -2);
|
||||
|
||||
else
|
||||
UpdateItemQualityValue(item, -4);
|
||||
}
|
||||
|
||||
private void HandleMiscelaniousItem(Item item)
|
||||
{
|
||||
if (item.SellIn > 0)
|
||||
|
||||
@ -33,7 +33,6 @@ namespace csharpcore
|
||||
SellIn = 5,
|
||||
Quality = 49
|
||||
},
|
||||
// this conjured item does not work properly yet
|
||||
new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user