Exemplo n.º 1
0
        public void It_should_never_update_the_quality(ItemType itemType)
        {
            var item = new Item
            {
                Id       = Guid.NewGuid(),
                Quality  = 40,
                ItemType = itemType,
                SellIn   = 20,
                Name     = string.Empty
            };

            GildedRoseQualityUpdater.UpdateQuality(item);
            GildedRoseStateServiceMock.Verify(x => x.UpdateQuality(item.Id, It.IsAny <int>()), Times.Never);
        }
Exemplo n.º 2
0
        public void It_should_never_update_SelIn(ItemType itemType, string name)
        {
            var item = new Item
            {
                Id       = Guid.NewGuid(),
                Quality  = 40,
                ItemType = itemType,
                SellIn   = 20,
                Name     = name
            };

            GildedRoseQualityUpdater.UpdateQuality(item);
            GildedRoseStateServiceMock.Verify(x => x.DecreaseSellIn(item.Id), Times.Never);
        }
Exemplo n.º 3
0
        public void It_should_increase_the_quality_when_current_quality_is_below_50(ItemType itemType)
        {
            var item = new Item
            {
                Id       = Guid.NewGuid(),
                Quality  = 49,
                ItemType = itemType,
                SellIn   = 20,
                Name     = string.Empty
            };

            GildedRoseQualityUpdater.UpdateQuality(item);
            GildedRoseStateServiceMock.Verify(x => x.UpdateQuality(item.Id, 1), Times.Once);
        }
Exemplo n.º 4
0
        public void It_should_update_quality_to_zero_when_sellIn_is_smaller_then_0()
        {
            var item = new Item
            {
                Id       = Guid.NewGuid(),
                Quality  = 20,
                ItemType = ItemType.BackstagePassesTAFKAL80ETCConcert,
                SellIn   = -1,
                Name     = ItemNames.BackstagePassesTAFKAL80ETCConcert
            };

            GildedRoseQualityUpdater.UpdateQuality(item);
            GildedRoseStateServiceMock.Verify(x => x.UpdateQualityToZero(item.Id), Times.Once);
        }
Exemplo n.º 5
0
        public void It_should_decrease_quality_of_conjured_items_correctly(int quality, int qualityDecrease)
        {
            var item = new Item
            {
                Id       = Guid.NewGuid(),
                Quality  = quality,
                ItemType = ItemType.ConjuredManaCace,
                SellIn   = 20,
                Name     = string.Empty
            };

            GildedRoseQualityUpdater.UpdateQuality(item);
            GildedRoseStateServiceMock.Verify(x => x.UpdateQuality(item.Id, -1), Times.Exactly(qualityDecrease));
        }
Exemplo n.º 6
0
        public void It_should_update_quality_of_backstagepasses_Correctly(int quality, int sellIn, int qualityAdition)
        {
            var item = new Item
            {
                Id       = Guid.NewGuid(),
                Quality  = quality,
                ItemType = ItemType.BackstagePassesTAFKAL80ETCConcert,
                SellIn   = sellIn,
                Name     = string.Empty
            };

            GildedRoseQualityUpdater.UpdateQuality(item);
            GildedRoseStateServiceMock.Verify(x => x.UpdateQuality(item.Id, 1), Times.Exactly(qualityAdition));
        }
Exemplo n.º 7
0
 public GivenAGildedRoseQualityUpdater()
 {
     GildedRoseStateServiceMock = new Mock <IGildedRoseStateService>();
     GildedRoseQualityUpdater   = new GildedRoseQualityUpdater(GildedRoseStateServiceMock.Object);
 }