36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
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)
|
|
{
|
|
var item = GenerateItem(inQuality, sellInDays);
|
|
_items.Add(item);
|
|
|
|
_rose.UpdateQuality();
|
|
Assert.Equal(sellInDays - 1, item.SellIn);
|
|
Assert.Equal(expectedQuality, item.Quality);
|
|
}
|
|
|
|
public Item GenerateItem(int quality, int sellInDays)
|
|
=> new Item {Name = "Conjured Mana Cake", Quality = quality, SellIn = sellInDays};
|
|
}
|
|
}
|