Example #1
0
        public void ConjuredTestQuality()
        {
            var conjuredItem = new Conjured();

            conjuredItem.EndOfDayUpdate(4, 5);
            conjuredItem.Quality.ShouldBe(3);
        }
Example #2
0
        public static ItemObjects ItemObjects(Item item)
        {
            ItemObjects inheritedItem = null;

            switch (item.Name)
            {
            case "+5 Dexterity Vest":
                inheritedItem = new DexterityVest(item);
                break;

            case "Aged Brie":
                inheritedItem = new AgedBrie(item);
                break;

            case "Elixir of the Mongoose":
                inheritedItem = new ElixirOfTheMongoose(item);
                break;

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

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

            case "Conjured Mana Cake":
                inheritedItem = new Conjured(item);
                break;
            }
            return(inheritedItem);
        }
        private Item GetItem(string category)
        {
            Item item;

            switch (category)
            {
            case AGEDBRIE_NAME:
                item = new AgedBrie();
                break;

            case BACKSTAGEPASSES_CATEGORY:
                item = new BackstagePasses();
                break;

            case CONJURED_CATEGORY:
                item = new Conjured();
                break;

            case SULFURAS_CATEGORY:
                item = new Sulfuras();
                break;

            default:
                item = new Item();
                break;
            }
            item.Category = category;
            return(item);
        }
Example #4
0
        public void QualityConjured()
        {
            Conjured item = new Conjured("testItem", 2, 6, (int)Product.ProductType.Conjured);

            item.Update();
            Assert.That(item.quality.Equals(4));
        }
        public void decreaseConjuredQualityFourTimesAfterADayWhenExceededSellInDays()
        {
            Conjured   item = Conjured.Create(name: "Conjured", sellIn: 0, quality: 20);
            GildedRose app  = new GildedRose(item);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(-1, item.SellIn);
            Assert.AreEqual(16, item.Quality);
        }
        public void decreaseConjuredQualityTwiceAfterADay()
        {
            Conjured   item = Conjured.Create(name: "Conjured", sellIn: 5, quality: 20);
            GildedRose app  = new GildedRose(item);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(4, item.SellIn);
            Assert.AreEqual(18, item.Quality);
        }
Example #7
0
        public void UpdateQuality_QualityStartsAboveMax_UpdatesToMax50Limit()
        {
            // Arrange
            Item i = new Conjured("Conjured", 10, 55);

            // Act
            i.UpdateQuality();

            //Assert
            Assert.Equal(50, i.Quality);
        }
Example #8
0
        public void UpdateQuality_Expired_QualityDegradesByFour()
        {
            // Arrange
            Item i = new Conjured("Conjured", -1, 10);

            // Act
            i.UpdateQuality();

            //Assert
            Assert.Equal(6, i.Quality);
        }
Example #9
0
        public void UpdateQuality_PositiveDaysToSell_QualityDegradesByTwo()
        {
            // Arrange
            Item i = new Conjured("Conjured", 10, 10);

            // Act
            i.UpdateQuality();

            //Assert
            Assert.Equal(8, i.Quality);
        }
        public void Test_ItemFactory_Create_Conjured_ReturnOk()
        {
            // Arrange
            Conjured conjured = new Conjured("Conjured", 0, 0);

            //Act
            var itemCreated = ItemFactory.Create("Conjured", 0, 0);

            //Assert
            Assert.Equal(itemCreated.GetType(), conjured.GetType());
        }
Example #11
0
        public void Test_Conjured_Update_Twice_ReturnOk()
        {
            // Arrange
            Conjured conjured = new Conjured("Backstage", 12, 2);

            //Act
            conjured.Update();

            //Assert
            Assert.Equal(0, conjured.Quality);
            Assert.Equal(11, conjured.SellIn);
        }
Example #12
0
        public void MoveForwardOneDay(int startingSellIn, int startingQuality, int resultSellIn, int resultQuality)
        {
            Conjured conjured = new Conjured()
            {
                SellIn = startingSellIn, Quality = startingQuality
            };

            conjured.MoveForwardOneDay();

            int expectedQuality = conjured.Quality;
            int sellin          = conjured.SellIn;

            Assert.That(sellin, Is.EqualTo(resultSellIn));
            Assert.That(expectedQuality, Is.EqualTo(resultQuality));
        }
Example #13
0
        public void itemQualityNeverNegative()
        {
            EditableItem item1         = EditableItem.Create("Syomay", sellIn: 5, quality: 0);
            EditableItem backstagePass = ConcertBackstagePass.Create("TaylorFast", sellIn: 0, quality: 0);
            EditableItem conjured      = Conjured.Create("Conjured", sellIn: 0, quality: 2);

            items.Add(item1);
            items.Add(backstagePass);
            items.Add(conjured);

            GildedRose app = new GildedRose(items);

            app.UpdateItemsQualityAfterADay();

            Assert.AreEqual(0, item1.Quality);
            Assert.AreEqual(0, backstagePass.Quality);
            Assert.AreEqual(0, conjured.Quality);
        }
Example #14
0
        public void Conjured_Item_Update()
        {
            Conjured item = new Conjured()
            {
                Name    = "Conjured",
                Quality = 10,
                SellIn  = 2
            };

            item.Update();
            Assert.AreEqual(8, item.Quality);
            Assert.AreEqual(1, item.SellIn);
            item.Update();
            Assert.AreEqual(6, item.Quality);
            Assert.AreEqual(0, item.SellIn);
            item.Update();
            Assert.AreEqual(2, item.Quality);
            Assert.AreEqual(-1, item.SellIn);
        }