示例#1
0
        public static Int32 GetQuality(string ItemName, Int32 Quality, Int32 Days)
        {
            var IncQuality  = new IncreaseQuality();
            var DecQualtity = new ReduceQuality();

            switch (ItemName)
            {
            case "Aged Brie":
                IncQuality.Days   = 1;
                IncQuality.Factor = 1;
                return(IncQuality.GetQuality(Quality));

            case "Backstage passes":
                IncQuality.Days   = 1;
                IncQuality.Factor = (Days < 10 && Days > 5 ? 2 : Days <= 5 ? 3 : 1);
                return(IncQuality.GetQuality(Quality));

            case "Sulfuras":
                return(Quality);

            case "Normal item":
                DecQualtity.Days   = 1;
                DecQualtity.Factor = 1;
                return(DecQualtity.GetQuality(Quality));

            case "Conjured":
                DecQualtity.Days   = 1;
                DecQualtity.Factor = 2;
                return(DecQualtity.GetQuality(Quality));

            default:
                return(-99);
            }
        }
示例#2
0
        public void TestDecrease()
        {
            var newItem       = new GRItems("Sulfuras", 2, 2);
            var ReduceQuality = new ReduceQuality();

            ReduceQuality.Days   = 1;
            ReduceQuality.Factor = 1;
            Assert.AreNotEqual(ReduceQuality.GetQuality(newItem.QualityValue), newItem.QualityValue);
        }