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 }, }; [Fact] public void ShouldNotIncreaseQualityMoreThan50() { var item = new Item {Name = "Aged Brie", SellIn = 1, Quality = 50}; var app = new GildedRose(new List {item}); app.UpdateQuality(); Assert.Equal("Aged Brie", item.Name); Assert.Equal(0, item.SellIn); Assert.Equal(50, item.Quality); } } }