public When_no_default_value_conventions_are_specified() { // Due to the nature of test runners that don't specify the order of tests // we must simulate the "default" convention here Fluency.Initialize(x => new FluencyConfiguration()); _item = new TestItemBuilder().build(); }
public void CalculateQuality_WhenItemIsNotRecognised_ThrowsNotFoundException(int sellInValue, int currentQuality, ItemType type) { //Arrange var item = TestItemBuilder.Build().WithSellInValue(sellInValue).WithQuality(currentQuality).WithItemType(type); //Act - Assert Assert.Throws <InvalidEnumArgumentException>(() => _sut.CalculateQuality(item)); }
public void CalculateQuality_WhenItemIsNormalItem_AndSellInValueIsNegative_QualityDegradsTwiceAsFast(int sellInValue, int currentQuality, int expectedQuality) { //Arrange var item = TestItemBuilder.Build().WithSellInValue(sellInValue).WithQuality(currentQuality).WithItemType(ItemType.NormalItem); //Act var result = _sut.CalculateQuality(item); //Assert Assert.Equal(expectedQuality, result); }
public void CalculateQuality_WhenItemIsNormalItem_AndSellInValueIsPositiveOrZero_QualityDropsBy1(int sellInValue, int quality) { //Arrange var item = TestItemBuilder.Build().WithSellInValue(sellInValue).WithQuality(quality).WithItemType(ItemType.NormalItem); //Act var result = _sut.CalculateQuality(item); //Assert Assert.Equal(quality - 1, result); }
public void UpdateInventory_WhenTypeIsSulfuras_ReturnsTheSameSellInValue(int sellInValue, ItemType type, int expectedSellInValue) { //Arrange var item = TestItemBuilder.Build().WithSellInValue(sellInValue).WithItemType(type); //Act _sut.UpdateInventory(item); //Assert Assert.Equal(expectedSellInValue, item.SellInValue); }
public void CalculateQuality_NeverReturnsANegativeValue(int quality, ItemType type) { //Arrange var item = TestItemBuilder.Build().WithQuality(quality).WithItemType(type); //Act var result = _sut.CalculateQuality(item); //Assert Assert.Equal(0, result); }
public void CalculateQuality_WhenItemIsBackstagePasses_AndSellInValueLessThanZero_QualityDropsToZero(int sellInValue, int currentQuality, int expectedQuality) { //Arrange var item = TestItemBuilder.Build().WithSellInValue(sellInValue).WithQuality(currentQuality).WithItemType(ItemType.BackstagePasses); //Act var result = _sut.CalculateQuality(item); //Assert Assert.Equal(expectedQuality, result); }
public void CalculateQuality_WhenItemIsConjured_QualityDropsAtTwiceTheRateOfNormaltems(int sellInValue, int currentQuality, int expectedQuality) { //Arrange var item = TestItemBuilder.Build().WithSellInValue(sellInValue).WithQuality(currentQuality).WithItemType(ItemType.Conjured); //Act var result = _sut.CalculateQuality(item); //Assert Assert.Equal(expectedQuality, result); }
public void CalculateQuality_WhenItemIsSulphuras_QualityStaysTheSame(int sellInValue, int currentQuality, int expectedQuality) { //Arrange var item = TestItemBuilder.Build().WithSellInValue(sellInValue).WithQuality(currentQuality).WithItemType(ItemType.Sulfuras); //Act var result = _sut.CalculateQuality(item); //Assert Assert.Equal(expectedQuality, result); }
public void UpdateInventory_CallsQualityCalculator_CorrectNumberOfTimes() { //Arrange var item = TestItemBuilder.Build(); //Act _sut.UpdateInventory(item); //Await _qualityCalculatorMock.Verify(x => x.CalculateQuality(It.IsAny <Item>()), Times.Once); }
public void CalculateQuality_WhenItemIsAgedBrie_QualityIncreases(int sellInValue, int currentQuality, int expectedQuality) { //Arrange var item = TestItemBuilder.Build().WithSellInValue(sellInValue).WithQuality(currentQuality).WithItemType(ItemType.AgedBrie); //Act var result = _sut.CalculateQuality(item); //Assert Assert.Equal(expectedQuality, result); }
public void CalculateQuality_WhenCalculatedQualityIsGreatherThan50_Returns50(int quality, ItemType type) { //Arrange var item = TestItemBuilder.Build().WithQuality(quality).WithItemType(type); //Act var result = _sut.CalculateQuality(item); //Assert Assert.Equal(50, result); }
public void UpdateInventory_WhenTypeIsNotSulfuras_CalculatesCorrectSellInValue(int sellInValue, int expectedSellInValue) { //Arrange var item = TestItemBuilder.Build().WithSellInValue(sellInValue); //Act _sut.UpdateInventory(item); //Assert Assert.Equal(expectedSellInValue, item.SellInValue); }
public void UpdateInventory_CallsQualityCalculator_WithCorrectValues(int sellInValue, int expectedSellInValue, int quality, ItemType type) { //Arrange var item = TestItemBuilder.Build().WithSellInValue(sellInValue).WithQuality(quality).WithItemType(type); _qualityCalculatorMock.Setup(x => x.CalculateQuality(It.IsAny <Item>())).Returns(It.IsAny <int>()); //Act _sut.UpdateInventory(item); //Assert _qualityCalculatorMock.Verify(x => x.CalculateQuality(item), Times.Once); }
public When_default_value_conventions_are_specified() { Fluency.Initialize(x => x.UseDefaultValueConventions()); _item = new TestItemBuilder().build(); }
public When_Fluency_is_configured_to_use_zero_for_ids() { Fluency.Initialize(x => x.IdGeneratorIsConstructedBy(() => new StaticValueIdGenerator(0))); _item = new TestItemBuilder().build(); }
public When_no_id_generator_is_specified_for_fluency() { Fluency.Initialize(x => new FluencyConfiguration()); _item = new TestItemBuilder().build(); }
public When_Fluency_is_configured_to_use_decrementing_ids() { Fluency.Initialize(x => x.IdGeneratorIsConstructedBy(() => new DecrementingIdGenerator())); _item = new TestItemBuilder().build(); }