static StrategySelector() { backstagePassStrategy = new BackstagePassStrategy(); agedBrieStrategy = new AgedBrieStrategy(); regularItemStrategy = new RegularItemStrategy(); sulfurasStrategy = new SulfurasStrategy(); conjuredStrategy = new ConjuredStrategy(); }
public void DecreaseSellIn_DecreasesSellInByOne() { var item = new Item { SellIn = 1 }; var subject = new BackstagePassStrategy(item); subject.DecreaseSellIn(); Assert.That(item.SellIn, Is.EqualTo(0)); }
public void PerformPreSellByUpdate_IncreasesQualityByThree_WhenSellInIsBetweenFiveAndOne(int sellIn) { var item = new Item { Quality = 1, SellIn = sellIn }; var subject = new BackstagePassStrategy(item); subject.PerformPreSellByUpdate(); Assert.That(item.Quality, Is.EqualTo(4)); }
public void PerformPreSellByUpdate_IncreasesQualityByOne_WhenSellInIsGreaterThanTen(int sellIn) { var item = new Item { Quality = 1, SellIn = sellIn }; var subject = new BackstagePassStrategy(item); subject.PerformPreSellByUpdate(); Assert.That(item.Quality, Is.EqualTo(2)); }
public void PerformPostSellByUpdate_SetsQualityToZero() { var item = new Item { Quality = 10 }; var subject = new BackstagePassStrategy(item); subject.PerformPostSellByUpdate(); Assert.That(item.Quality, Is.EqualTo(0)); }
public void ItemQualityManager_UpdateBackStagePass_QualityChanges(int currentSellIn, int expectedQuality) { // Arrange var strategy = new BackstagePassStrategy(); var item = new ItemBuilder(Constants.BackstagePass) .WithQuality(20) .WithSellIn(currentSellIn) .Build(); // Act strategy.UpdateItemQuality(item); // Assert Assert.Equal(expectedQuality, item.Quality); }
public void UpdateQuality_WhenSellInDaysIsHigherThanZero_DecreasesSellInByOne() { // Arrange var item = new Item { SellIn = 5 }; var backstagePassStrategy = new BackstagePassStrategy(); // Act backstagePassStrategy.UpdateQuality(item); // Assert var expectedSellInDays = 4; Assert.Equal(expectedSellInDays, item.SellIn); }
public void UpdateQuality_WhenSellInDaysIsBelowZero_DecreasesQualityToZero() { // Arrange var item = new Item { SellIn = -1, Quality = 5 }; var backstagePassStrategy = new BackstagePassStrategy(); // Act backstagePassStrategy.UpdateQuality(item); // Assert var expectedQuality = 0; Assert.Equal(expectedQuality, item.Quality); }
public void UpdateQuality_WhenSellInDaysIs_IncreasesQualityBy(int initialSellIn, int qualityShouldIncreaseBy) { // Arrange const int initialQuality = 5; var item = new Item { SellIn = initialSellIn, Quality = initialQuality }; var backstagePassStrategy = new BackstagePassStrategy(); // Act backstagePassStrategy.UpdateQuality(item); // Assert var expectedQuality = initialQuality + qualityShouldIncreaseBy; Assert.Equal(expectedQuality, item.Quality); }