using System.Collections.Generic; using Xunit; namespace csharpcore { public class AgedBrieTest { [Theory] [MemberData(nameof(AgedBrieData))] public void ShouldIncreaseQuality(int sellIn, int quality, int expectedQuality) { var item = new Item {Name = "Aged Brie", SellIn = sellIn, Quality = quality}; var app = new GildedRose(new List {item}); app.UpdateQuality(); Assert.Equal("Aged Brie", item.Name); Assert.Equal(sellIn - 1, item.SellIn); Assert.Equal(expectedQuality, item.Quality); } public static object[][] AgedBrieData => new[] { /* sellIn, quality, expectedQuality*/ new object[]{ 1, 1, 2 }, new object[]{ 0, 1, 3 }, new object[]{ -1, 1, 3 }, }; [Theory] [InlineData(1, 0)] [InlineData(-1, -2)] public void ShouldNotIncreaseQualityMoreThan50(int startSellInDays, int expectedSellInDays) { var item = new Item {Name = "Aged Brie", SellIn = startSellInDays, Quality = 50}; var app = new GildedRose(new List {item}); app.UpdateQuality(); Assert.Equal("Aged Brie", item.Name); Assert.Equal(expectedSellInDays, item.SellIn); Assert.Equal(50, item.Quality); } } }