mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-10-16 02:53:57 +00:00
Refactor C# projects
This commit is contained in:
1 parent
c7e0b4a8d9
commit
6e5067dcb9
33 files changed
+814
-645
No files matched your search
@@ -0,0 +1,89 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace GildedRoseKata;
|
||||
|
||||
public class GildedRose
|
||||
{
|
||||
private readonly IList<Item> _items;
|
||||
|
||||
public GildedRose(IList<Item> items)
|
||||
{
|
||||
_items = items;
|
||||
}
|
||||
|
||||
public void UpdateQuality()
|
||||
{
|
||||
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].Quality > 0)
|
||||
{
|
||||
if (_items[i].Name != "Sulfuras, Hand of Ragnaros")
|
||||
{
|
||||
_items[i].Quality = _items[i].Quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_items[i].Quality < 50)
|
||||
{
|
||||
_items[i].Quality = _items[i].Quality + 1;
|
||||
|
||||
if (_items[i].Name == "Backstage passes to a TAFKAL80ETC concert")
|
||||
{
|
||||
if (_items[i].SellIn < 11)
|
||||
{
|
||||
if (_items[i].Quality < 50)
|
||||
{
|
||||
_items[i].Quality = _items[i].Quality + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (_items[i].SellIn < 6)
|
||||
{
|
||||
if (_items[i].Quality < 50)
|
||||
{
|
||||
_items[i].Quality = _items[i].Quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_items[i].Name != "Sulfuras, Hand of Ragnaros")
|
||||
{
|
||||
_items[i].SellIn = _items[i].SellIn - 1;
|
||||
}
|
||||
|
||||
if (_items[i].SellIn < 0)
|
||||
{
|
||||
if (_items[i].Name != "Aged Brie")
|
||||
{
|
||||
if (_items[i].Name != "Backstage passes to a TAFKAL80ETC concert")
|
||||
{
|
||||
if (_items[i].Quality > 0)
|
||||
{
|
||||
if (_items[i].Name != "Sulfuras, Hand of Ragnaros")
|
||||
{
|
||||
_items[i].Quality = _items[i].Quality - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_items[i].Quality = _items[i].Quality - _items[i].Quality;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_items[i].Quality < 50)
|
||||
{
|
||||
_items[i].Quality = _items[i].Quality + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user