public void UpdateQuality()
 {
     for (var i = 0; i < Items.Count; i++)
     {
         Item item = Items[i];
         QualityFactory.GetQualityManager(item).UpdateItemQuality(item);
         SellInUpdater.UpdateSellIn(item);
     }
 }
Exemplo n.º 2
0
        public void ReturnsRegularQualityManager()
        {
            IList <Item> Items = new List <Item>
            {
                new Item {
                    Name = "+5 Dexterity Vest", SellIn = 0, Quality = 10
                }
            };
            QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

            Assert.AreEqual(qualityUpdater.GetType(), typeof(QualityUpdater));
        }
Exemplo n.º 3
0
        public void ReturnsStagePassQualityManager()
        {
            IList <Item> Items = new List <Item>
            {
                new Item {
                    Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 0, Quality = 10
                }
            };
            QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

            Assert.AreEqual(qualityUpdater.GetType(), typeof(BackstagePassQualityUpdater));
        }
Exemplo n.º 4
0
        public void ReturnsBrieQualityManager()
        {
            IList <Item> Items = new List <Item>
            {
                new Item {
                    Name = "Aged Brie", SellIn = 0, Quality = 10
                }
            };
            QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

            Assert.AreEqual(qualityUpdater.GetType(), typeof(AgedBrieQualityUpdater));
        }
Exemplo n.º 5
0
        public void ReturnsSulfurasQualityManager()
        {
            IList <Item> Items = new List <Item>
            {
                new Item {
                    Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 10
                }
            };
            QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

            Assert.AreEqual(qualityUpdater.GetType(), typeof(SulfurasQualityUpdater));
        }
Exemplo n.º 6
0
        public void BrieQualityGoesUpOnce()
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "Aged Brie", SellIn = 100, Quality = 0
                }
            };
            QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

            qualityUpdater.UpdateItemQuality(Items[0]);
            Assert.AreEqual(1, Items[0].Quality);
        }
Exemplo n.º 7
0
        public void ConjuredItemLosesQualityOnce()
        {
            IList <Item> Items = new List <Item>
            {
                new Item {
                    Name = "Conjured Kudzu", SellIn = 10, Quality = 20
                }
            };
            QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

            qualityUpdater.UpdateItemQuality(Items[0]);
            Assert.AreEqual(18, Items[0].Quality);
        }
        public void RegularItemLosesQualityOnce()
        {
            IList <Item> Items = new List <Item>
            {
                new Item {
                    Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20
                }
            };
            QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

            qualityUpdater.UpdateItemQuality(Items[0]);
            Assert.AreEqual(19, Items[0].Quality);
        }
        public void StagePassQualityGoesUpOverTime()
        {
            IList <Item> Items = new List <Item>
            {
                new Item {
                    Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 100, Quality = 10
                }
            };
            QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

            qualityUpdater.UpdateItemQuality(Items[0]);

            Assert.AreEqual(11, Items[0].Quality);
        }
        public void StagePassQualityIncreasesFasterWithFiveDaysLeft()
        {
            IList <Item> Items = new List <Item>
            {
                new Item {
                    Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 5, Quality = 10
                }
            };
            QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

            qualityUpdater.UpdateItemQuality(Items[0]);

            Assert.AreEqual(13, Items[0].Quality);
        }
        public void RegularItemLosesQualityMultipleTimes()
        {
            for (int numDaysToSimulate = 0; numDaysToSimulate < 30; numDaysToSimulate++)
            {
                IList <Item> Items = new List <Item>
                {
                    new Item {
                        Name = "+5 Dexterity Vest", SellIn = 50, Quality = 40
                    }
                };
                QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

                for (int j = 0; j < numDaysToSimulate; j++)
                {
                    qualityUpdater.UpdateItemQuality(Items[0]);
                }
                Assert.AreEqual(40 - numDaysToSimulate, Items[0].Quality);
            }
        }
Exemplo n.º 12
0
        public void ConjuredItemLosesQualityMultipleTimes()
        {
            for (int numDaysToSimulate = 0; numDaysToSimulate < 15; numDaysToSimulate++)
            {
                IList <Item> Items = new List <Item>
                {
                    new Item {
                        Name = "Conjured Kudzu", SellIn = 50, Quality = 40
                    }
                };
                QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

                for (int j = 0; j < numDaysToSimulate; j++)
                {
                    qualityUpdater.UpdateItemQuality(Items[0]);
                }

                Assert.AreEqual(40 - (2 * numDaysToSimulate), Items[0].Quality);
            }
        }
        public void RegularItemQualityNeverBelow0()
        {
            for (int numDaysToSimulate = 0; numDaysToSimulate < 30; numDaysToSimulate++)
            {
                IList <Item> Items = new List <Item>
                {
                    new Item {
                        Name = "+5 Dexterity Vest", SellIn = 10, Quality = 10
                    }
                };
                QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

                for (int j = 0; j < numDaysToSimulate; j++)
                {
                    qualityUpdater.UpdateItemQuality(Items[0]);
                }

                Assert.GreaterOrEqual(Items[0].Quality, 0);
            }
        }
        public void RegularItemQualityDecreasesTwiceAsFastPastSellInDate()
        {
            for (int numDaysToSimulate = 0; numDaysToSimulate < 10; numDaysToSimulate++)
            {
                IList <Item> Items = new List <Item>
                {
                    new Item {
                        Name = "+5 Dexterity Vest", SellIn = 0, Quality = 50
                    }
                };
                QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

                for (int j = 0; j < numDaysToSimulate; j++)
                {
                    qualityUpdater.UpdateItemQuality(Items[0]);
                }

                Assert.AreEqual(50 - (2 * numDaysToSimulate), Items[0].Quality);
            }
        }
        public void StagePassQualityNeverAbove50()
        {
            for (int numDaysToSimulate = 0; numDaysToSimulate < 30; numDaysToSimulate++)
            {
                IList <Item> Items = new List <Item>
                {
                    new Item {
                        Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = 15, Quality = 40
                    }
                };
                QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);

                for (int j = 0; j < numDaysToSimulate; j++)
                {
                    qualityUpdater.UpdateItemQuality(Items[0]);
                }

                Assert.LessOrEqual(Items[0].Quality, 50);
            }
        }
Exemplo n.º 16
0
        public void BrieQualityGoesUpMultipleTimes()
        {
            for (int numDaysToSimulate = 0; numDaysToSimulate < 30; numDaysToSimulate++)
            {
                IList <Item> Items = new List <Item>
                {
                    new Item {
                        Name = "Aged Brie", SellIn = 100, Quality = 10
                    }
                };
                QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);


                for (int j = 0; j < numDaysToSimulate; j++)
                {
                    qualityUpdater.UpdateItemQuality(Items[0]);
                }

                Assert.AreEqual(10 + numDaysToSimulate, Items[0].Quality);
            }
        }
Exemplo n.º 17
0
        public void BrieQualityNeverAbove50()
        {
            for (int numDaysToSimulate = 0; numDaysToSimulate < 30; numDaysToSimulate++)
            {
                IList <Item> Items = new List <Item>
                {
                    new Item {
                        Name = "Aged Brie", SellIn = 15, Quality = 40
                    }
                };
                QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);


                for (int j = 0; j < numDaysToSimulate; j++)
                {
                    qualityUpdater.UpdateItemQuality(Items[0]);
                }

                Assert.LessOrEqual(Items[0].Quality, 50);
            }
        }
Exemplo n.º 18
0
        public void BrieQualityGoesUpTwiceAsFastPastSellInDate()
        {
            for (int numDaysToSimulate = 0; numDaysToSimulate < 10; numDaysToSimulate++)
            {
                IList <Item> Items = new List <Item>
                {
                    new Item {
                        Name = "Aged Brie", SellIn = 0, Quality = 10
                    }
                };
                QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);


                for (int j = 0; j < numDaysToSimulate; j++)
                {
                    qualityUpdater.UpdateItemQuality(Items[0]);
                }

                Assert.AreEqual(10 + (2 * numDaysToSimulate), Items[0].Quality);
            }
        }
Exemplo n.º 19
0
        public void SulfurasImmutableQualityOverTime()
        {
            for (int numDaysToSimulate = 0; numDaysToSimulate < 30; numDaysToSimulate++)
            {
                IList <Item> Items = new List <Item>
                {
                    new Item {
                        Name = "Sulfuras, Hand of Ragnaros", SellIn = 20, Quality = 80
                    }
                };
                QualityUpdater qualityUpdater = QualityFactory.GetQualityManager(Items[0]);


                for (int j = 0; j < numDaysToSimulate; j++)
                {
                    qualityUpdater.UpdateItemQuality(Items[0]);
                }

                Assert.AreEqual(80, Items[0].Quality);
            }
        }