Exemplo n.º 1
0
        public static IItem GetCustomItem(Item item)
        {
            IItem _item = new StandardItem(item);

            switch (item.Name)
            {
            case "Aged Brie":
                _item = new AgedItem(item);
                break;

            case "Sulfuras, Hand of Ragnaros":
                _item = new LegendaryItem(item);
                break;

            case "Backstage passes to a TAFKAL80ETC concert":
                _item = new PassItem(item);
                break;

            case "Conjured Mana Cake":
                _item = new ConjuredItem(item);
                break;

            default:
                break;
            }

            return(_item);
        }
Exemplo n.º 2
0
        public void Aged_Item_Quality_Should_Increase_The_Older_It_Gets_Twice_As_Fast_After_Sell_Date()
        {
            // Arrange
            var agedItem = new AgedItem("Aged Brie", 0, 0);

            // Act
            agedItem.UpdateQuality();

            // Assert
            Assert.AreEqual(agedItem.Quality, 2);
        }
Exemplo n.º 3
0
        public void Aged_Item_Quality_Should_Increase_The_Older_It_Gets()
        {
            // Arrange
            var agedItem = new AgedItem("Aged Brie", 2, 0);

            // Act
            agedItem.UpdateQuality();

            // Assert
            Assert.AreEqual(agedItem.Quality, 1);
            Assert.AreEqual(agedItem.SellIn, 1);
        }
Exemplo n.º 4
0
        public void The_Quality_Of_An_Item_Should_Never_Be_More_Than_50_For_BackStage_And_Aged_Items()
        {
            // Arrange
            var backstageItem = new BackstageItem("Backstage passes to a TAFKAL80ETC concert", 20, 50);
            var agedItem      = new AgedItem("Aged Brie", 2, 50);

            // Act
            backstageItem.UpdateQuality();
            agedItem.UpdateQuality();

            // Assert
            Assert.AreEqual(backstageItem.Quality, 50);
            Assert.AreEqual(agedItem.Quality, 50);
        }
Exemplo n.º 5
0
        public void Updating_The_Quality_Of_An_Item_Should_Never_Be_Negative()
        {
            // Arrange
            var commonItem    = new CommonItem("+5 Dexterity Vest", 0, 0);
            var backstageItem = new BackstageItem("Backstage passes to a TAFKAL80ETC concert", 20, 0);
            var agedItem      = new AgedItem("Aged Brie", 2, 0);
            var conjuredItem  = new ConjuredItem("Conjured Mana Cake", 3, 0);
            var legendaryItem = new LegendaryItem("Sulfuras, Hand of Ragnaros", 0, 80);

            // Act
            commonItem.UpdateQuality();
            backstageItem.UpdateQuality();
            agedItem.UpdateQuality();
            conjuredItem.UpdateQuality();
            legendaryItem.UpdateQuality();

            // Assert
            Assert.AreEqual(commonItem.Quality, 0);
            Assert.AreEqual(backstageItem.Quality, 1);
            Assert.AreEqual(agedItem.Quality, 1);
            Assert.AreEqual(conjuredItem.Quality, 0);
            Assert.AreEqual(legendaryItem.Quality, 80);
        }