// TODO how can I make this test use a Theory? //[InlineData("Aged Brie")] //[InlineData("Backstage passes to a TAFKAL80ETC concert")] //[InlineData("Generic sword")] //[InlineData("Sulfuras, Hand of Ragnaros")] public void DegradationStrategyFactoryReturnsCorrectStrategy() { var strategyFactory = new DegradationStrategyFactory(); var item = new Item() { Name = "Aged Brie" }; var strategy = strategyFactory.GetDegradeStrategy(item); Assert.IsType <BackstagePassDegradationStrategy>(strategy); }
public void DegradationStrategyFactoryReturnsCorrectStrategy(string itemName, object strategyType) { var strategyFactory = new DegradationStrategyFactory(); var item = new Item() { Name = itemName }; var strategy = strategyFactory.GetDegradeStrategy(item); Assert.Equal(strategyType, strategy.GetType()); }
[InlineData("Elixir of Mongoose", 5, 4)] // Regression- quality decrements for non-backstage pass items // “Aged Brie” actually increases in Quality the older it gets // “Backstage passes”, like aged brie, increases in Quality as it’s SellIn value approaches; // Quality increases by 2 when there are 10 days or less and by 3 when there are 5 days or less but Quality drops to 0 after the concert public void SomeProductsIncreaseInQualityOverTime(string itemName, int sellIn, int expectedQuality) { var item = new Item() { Quality = 5, Name = itemName, SellIn = sellIn }; var strategyFactory = new DegradationStrategyFactory(); var strategy = strategyFactory.GetDegradeStrategy(item); strategy.Degrade(item); Assert.Equal(expectedQuality, item.Quality); }