mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-11 20:51:27 +00:00
Empyt line + IList<Item> Items;
This commit is contained in:
parent
608f368757
commit
26ce76c750
@ -34,7 +34,6 @@ public class Program
|
|||||||
SellIn = 5,
|
SellIn = 5,
|
||||||
Quality = 49
|
Quality = 49
|
||||||
},
|
},
|
||||||
|
|
||||||
// this conjured item does not work properly yet
|
// this conjured item does not work properly yet
|
||||||
new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
|
new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -4,83 +4,83 @@ namespace GildedRoseKata;
|
|||||||
|
|
||||||
public class GildedRose
|
public class GildedRose
|
||||||
{
|
{
|
||||||
private readonly IList<Item> _items;
|
IList<Item> Items;
|
||||||
|
|
||||||
public GildedRose(IList<Item> items)
|
public GildedRose(IList<Item> Items)
|
||||||
{
|
{
|
||||||
_items = items;
|
this.Items = Items;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateQuality()
|
public void UpdateQuality()
|
||||||
{
|
{
|
||||||
for (var i = 0; i < _items.Count; i++)
|
for (var i = 0; i < Items.Count; i++)
|
||||||
{
|
{
|
||||||
if (_items[i].Name != "Aged Brie" && _items[i].Name != "Backstage passes to a TAFKAL80ETC concert")
|
if (Items[i].Name != "Aged Brie" && Items[i].Name != "Backstage passes to a TAFKAL80ETC concert")
|
||||||
{
|
{
|
||||||
if (_items[i].Quality > 0)
|
if (Items[i].Quality > 0)
|
||||||
{
|
{
|
||||||
if (_items[i].Name != "Sulfuras, Hand of Ragnaros")
|
if (Items[i].Name != "Sulfuras, Hand of Ragnaros")
|
||||||
{
|
{
|
||||||
_items[i].Quality = _items[i].Quality - 1;
|
Items[i].Quality = Items[i].Quality - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_items[i].Quality < 50)
|
if (Items[i].Quality < 50)
|
||||||
{
|
{
|
||||||
_items[i].Quality = _items[i].Quality + 1;
|
Items[i].Quality = Items[i].Quality + 1;
|
||||||
|
|
||||||
if (_items[i].Name == "Backstage passes to a TAFKAL80ETC concert")
|
if (Items[i].Name == "Backstage passes to a TAFKAL80ETC concert")
|
||||||
{
|
{
|
||||||
if (_items[i].SellIn < 11)
|
if (Items[i].SellIn < 11)
|
||||||
{
|
{
|
||||||
if (_items[i].Quality < 50)
|
if (Items[i].Quality < 50)
|
||||||
{
|
{
|
||||||
_items[i].Quality = _items[i].Quality + 1;
|
Items[i].Quality = Items[i].Quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_items[i].SellIn < 6)
|
if (Items[i].SellIn < 6)
|
||||||
{
|
{
|
||||||
if (_items[i].Quality < 50)
|
if (Items[i].Quality < 50)
|
||||||
{
|
{
|
||||||
_items[i].Quality = _items[i].Quality + 1;
|
Items[i].Quality = Items[i].Quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_items[i].Name != "Sulfuras, Hand of Ragnaros")
|
if (Items[i].Name != "Sulfuras, Hand of Ragnaros")
|
||||||
{
|
{
|
||||||
_items[i].SellIn = _items[i].SellIn - 1;
|
Items[i].SellIn = Items[i].SellIn - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_items[i].SellIn < 0)
|
if (Items[i].SellIn < 0)
|
||||||
{
|
{
|
||||||
if (_items[i].Name != "Aged Brie")
|
if (Items[i].Name != "Aged Brie")
|
||||||
{
|
{
|
||||||
if (_items[i].Name != "Backstage passes to a TAFKAL80ETC concert")
|
if (Items[i].Name != "Backstage passes to a TAFKAL80ETC concert")
|
||||||
{
|
{
|
||||||
if (_items[i].Quality > 0)
|
if (Items[i].Quality > 0)
|
||||||
{
|
{
|
||||||
if (_items[i].Name != "Sulfuras, Hand of Ragnaros")
|
if (Items[i].Name != "Sulfuras, Hand of Ragnaros")
|
||||||
{
|
{
|
||||||
_items[i].Quality = _items[i].Quality - 1;
|
Items[i].Quality = Items[i].Quality - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_items[i].Quality = _items[i].Quality - _items[i].Quality;
|
Items[i].Quality = Items[i].Quality - Items[i].Quality;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_items[i].Quality < 50)
|
if (Items[i].Quality < 50)
|
||||||
{
|
{
|
||||||
_items[i].Quality = _items[i].Quality + 1;
|
Items[i].Quality = Items[i].Quality + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,6 @@ public class Program
|
|||||||
SellIn = 5,
|
SellIn = 5,
|
||||||
Quality = 49
|
Quality = 49
|
||||||
},
|
},
|
||||||
|
|
||||||
// this conjured item does not work properly yet
|
// this conjured item does not work properly yet
|
||||||
new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
|
new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user