Beispiel #1
0
        private IProcessItem GetItemProcess(Item item)
        {
            IProcessItem process = null;

            if (item.Name.Contains("Brie"))
            {
                return(process = new BrieItem());
            }
            else if (item.Name.Contains("Dexterity"))
            {
                return(process = new DexterityItem());
            }
            else if (item.Name.Contains("Elixir"))
            {
                return(process = new ElixirItem());
            }
            else if (item.Name.Contains("Sulfuras"))
            {
                return(process = new SulfurasItem());
            }
            else if (item.Name.Contains("Backstage"))
            {
                return(process = new BackstageItem());
            }
            else if (item.Name.Contains("Conjured"))
            {
                return(process = new ConjuredItem());
            }
            else
            {
                return(process = new OtherItem());
            }
        }
        public static DefaultItem CreateItem(Item item)
        {
            DefaultItem createdItem;

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

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

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

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

            default:
                createdItem = new DefaultItem(item);
                break;
            }

            return(createdItem);
        }
Beispiel #3
0
        public void Conjured()
        {
            ConjuredItem i = new ConjuredItem {
                Name = "Conjured Mana Cake", SellIn = 2, Quality = 5
            };

            i.ChangeQuality();

            //"Conjured" items degrade in Quality twice as fast as normal items
            //not implemented in original version. should fail
            Assert.AreEqual(3, i.Quality);
        }