示例#1
0
        public void QualityIsNeverAbove50()
        {
            _sellingItem.Quality = 53;
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(50, s.Quality);
        }
示例#2
0
        public void QualityIsNeverBelowZero()
        {
            _sellingItem.Quality = 0;
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(0, s.Quality);
        }
        public void SellingDaysIs1_Then_QualityIs0()
        {
            _sellingItem.Quality     = 0;
            _sellingItem.SellingDays = 1;
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(0, s.Quality);
        }
示例#4
0
        public void QualityDecreasesByTwo()
        {
            _sellingItem.SellingDays = 5;
            _sellingItem.Quality     = 5;
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(3, s.Quality);
        }
        public void QualityDegradesTwiceAsFastWhenSellingDaysHasPassed()
        {
            _sellingItem.SellingDays = -1;
            _sellingItem.Quality     = 5;
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(3, s.Quality);
        }
        public void SellingDaysIs5_Then_QualityIncreasesByThree()
        {
            _sellingItem.Quality     = 20;
            _sellingItem.SellingDays = 5;
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(23, s.Quality);
        }
        public void SellingDaysIs10_Then_QualityIncreasesByTwo()
        {
            _sellingItem.Quality     = 20;
            _sellingItem.SellingDays = 10;
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(22, s.Quality);
        }
        public void SellingDaysIsGreaterThan10_Then_QualityIncreasesByOne()
        {
            _sellingItem.Quality     = 15;
            _sellingItem.SellingDays = 15;
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(16, s.Quality);
        }
示例#9
0
        static void Main(string[] args)
        {
            var si = new List <SellingItem>()
            {
                new SellingItem()
                {
                    Name = "Aged Brie", Quality = 1, SellingDays = 1
                },
                new SellingItem()
                {
                    Name = "Backstage passes", Quality = 2, SellingDays = -1
                },
                new SellingItem()
                {
                    Name = "Backstage passes", Quality = 2, SellingDays = 9
                },
                new SellingItem()
                {
                    Name = "Sulfuras", Quality = 2, SellingDays = 2
                },
                new SellingItem()
                {
                    Name = "Normal Item", Quality = 55, SellingDays = -1
                },
                new SellingItem()
                {
                    Name = "Normal Item", Quality = 2, SellingDays = 2
                },
                new SellingItem()
                {
                    Name = "INVALID ITEM", Quality = 2, SellingDays = 2
                },
                new SellingItem()
                {
                    Name = "Conjured", Quality = 2, SellingDays = 2
                },
                new SellingItem()
                {
                    Name = "Conjured", Quality = 5, SellingDays = -1
                },
            };

            si.ForEach(x => {
                var i = InventoryFactory.Get(x);
                if (i is Invalid)
                {
                    Console.WriteLine($"{i.Name}");
                }
                else
                {
                    Console.WriteLine($"{i.Name} {i.SellingDays} {i.Quality}");
                }
            });
        }
示例#10
0
        public void QualityDoesNotDecrease()
        {
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(1, s.Quality);
        }
示例#11
0
        public void DaysDoNotDecrease()
        {
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(1, s.SellingDays);
        }
示例#12
0
        public void NameIsInvalidItem()
        {
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(s.Name, "NO SUCH ITEM");
        }
示例#13
0
 public void DoesNotThrow()
 {
     Assert.DoesNotThrow(() => { InventoryFactory.Get(_sellingItem); });
 }
示例#14
0
        public void SellingDaysDecreasesByOne()
        {
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(0, s.SellingDays);
        }
示例#15
0
        public void QualityDecreasesByOne()
        {
            var s = InventoryFactory.Get(_sellingItem);

            Assert.AreEqual(0, s.Quality);
        }