gilded-rose-dotnet-core/test/ConjuredTest.cs

36 lines
1.0 KiB
C#
Raw Permalink Normal View History

2020-08-31 22:13:03 +00:00
using System.Collections.Generic;
using Xunit;
namespace csharpcore
{
// "Conjured" items degrade in Quality twice as fast as normal items
public class ConjuredTest
{
private readonly List<Item> _items;
private GildedRose _rose;
public ConjuredTest()
{
_items = new List<Item>();
_rose =new GildedRose(_items);
}
[Theory]
[InlineData(3, 2, 1)]
[InlineData(5, 1, 3)]
[InlineData(5, 0, 1)]
public void ShouldDecreaseInQualityTwiceAsFastAsNormalItems(int inQuality, int sellInDays, int expectedQuality)
2020-08-31 22:13:03 +00:00
{
var item = GenerateItem(inQuality, sellInDays);
2020-08-31 22:13:03 +00:00
_items.Add(item);
_rose.UpdateQuality();
Assert.Equal(sellInDays - 1, item.SellIn);
Assert.Equal(expectedQuality, item.Quality);
2020-08-31 22:13:03 +00:00
}
2020-08-31 22:13:03 +00:00
public Item GenerateItem(int quality, int sellInDays)
=> new Item {Name = "Conjured Mana Cake", Quality = quality, SellIn = sellInDays};
}
}