Exercicio Pronto

This commit is contained in:
Rodrigo raymundo schmidt 2022-02-21 00:28:20 -03:00
parent 9d878b7641
commit a0ef864df6

View File

@ -5,9 +5,9 @@ namespace GildedRoseKata
public class GildedRose public class GildedRose
{ {
IList<Item> Items; IList<Item> Items;
public GildedRose(IList<Item> Items) public GildedRose(IList<Item> items)
{ {
this.Items = Items; Items = items;
} }
public void UpdateQuality() public void UpdateQuality()
@ -26,25 +26,25 @@ namespace GildedRoseKata
} }
else else
{ {
if (Items[i].Quality < 50) if (Items[i].Quality < 50 || Items[i].Quality >= 0)
{ {
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" || Items[i].Name == "Aged Brie")
{ {
if (Items[i].SellIn < 11) if (Items[i].SellIn <= 10)
{ {
if (Items[i].Quality < 50) if (Items[i].Quality < 50)
{ {
Items[i].Quality = Items[i].Quality + 1; Items[i].Quality = Items[i].Quality + 2;
} }
} }
if (Items[i].SellIn < 6) if (Items[i].SellIn <= 5)
{ {
if (Items[i].Quality < 50) if (Items[i].Quality < 50)
{ {
Items[i].Quality = Items[i].Quality + 1; Items[i].Quality = Items[i].Quality + 3;
} }
} }
} }
@ -66,7 +66,7 @@ namespace GildedRoseKata
{ {
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 - 2;
} }
} }
} }
@ -77,13 +77,24 @@ namespace GildedRoseKata
} }
else else
{ {
if (Items[i].Quality > 50)
{
Items[i].Quality = 50;
}
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 == "Conjured")
{
Items[i].Quality = Items[i].Quality - 2;
}
} }
} }
} }
} }