public void GivenOrdinaryItemHandler_WhenViolatingTheHandlingPermissionRule_ThenShouldThrowException() { var ordinaryItemHandler = new OrdinaryItemHandler(null); var item = new Item() { Name = AgedBrie, Quality = 1, SellIn = 1 }; Assert.Throws <InvalidOperationException>(() => ordinaryItemHandler.Handle(item), "Item cannot be handled here"); item = new Item() { Name = BackstagePasses, Quality = 1, SellIn = 1 }; Assert.Throws <InvalidOperationException>(() => ordinaryItemHandler.Handle(item), "Item cannot be handled here"); item = new Item() { Name = Sulfuras, Quality = 1, SellIn = 1 }; Assert.Throws <InvalidOperationException>(() => ordinaryItemHandler.Handle(item), "Item cannot be handled here"); }
public void GivenOrdinaryItemHandler_WhenNextDayComes_QualityEquals1_SellInLessThan0_ThenQualityShouldBe0() { // Arrange var item = new Item() { Name = "Ordinary Item", Quality = 1, SellIn = -1 }; // Act var actual = new OrdinaryItemHandler(null); actual.Handle(item); // Assert Assert.AreEqual(0, item.Quality); }
public void GivenOrdinaryItemHandler_WhenNextDayComes_QualityHigherThan2_SellInEquals0_ThenQualityShouldDecreaseByTwo() { // Arrange var item = new Item() { Name = "Ordinary Item", Quality = 35, SellIn = 0 }; // Act var actual = new OrdinaryItemHandler(null); actual.Handle(item); // Assert Assert.AreEqual(33, item.Quality); }