Esempio n. 1
0
        public void foo()
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "foo", SellIn = 0, Quality = 0
                }
            };

            GildedRoseKata.GildedRose app = new GildedRoseKata.GildedRose(Items);
            app.UpdateQuality();
            Assert.Equal("foo", Items[0].Name);
        }
Esempio n. 2
0
        private string UpdateQuality(string name, int sellIn, int quality)
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = name, SellIn = sellIn, Quality = quality
                }
            };

            GildedRoseKata.GildedRose app = new GildedRoseKata.GildedRose(Items);
            app.UpdateQuality();

            return(Items[0].Name + ", " + Items[0].SellIn + ", " + Items[0].Quality);
        }
Esempio n. 3
0
        public void ReturnsTheQualityPlusOneWhenTheNameIsBackstagePassesToATAFKAL80ETCConcertAndValueOfSellInIsGreaterThanTen(int sellIn, int quality)
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = sellIn, Quality = quality
                }
            };

            GildedRoseKata.GildedRose app = new GildedRoseKata.GildedRose(Items);
            app.UpdateQuality();

            Assert.Equal(quality + 1, Items[0].Quality);
        }
Esempio n. 4
0
        public void ReturnsTheSameQualityWhenTheNameIsSulfurasHandsOfRagnarosAndAnyValueOfSellIn(int sellIn, int quality)
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "Sulfuras, Hand of Ragnaros", SellIn = sellIn, Quality = quality
                }
            };

            GildedRoseKata.GildedRose app = new GildedRoseKata.GildedRose(Items);
            app.UpdateQuality();

            Assert.Equal(quality, Items[0].Quality);
        }
Esempio n. 5
0
        public void ReturnsQuality0WhenTheNameIsBackstagePassesToATAFKAL80ETCConcertAndNegativeOrZeroValueOfSellIn(int sellIn, int quality)
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = sellIn, Quality = quality
                }
            };

            GildedRoseKata.GildedRose app = new GildedRoseKata.GildedRose(Items);
            app.UpdateQuality();

            Assert.Equal(quality - quality, Items[0].Quality);
        }
Esempio n. 6
0
        public void ReturnsTheQualityLessTwoWhenTheNameIsNotAreservedNameAndValueOfSellInIsMinorThanOne(int sellIn, int quality)
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "Varita1", SellIn = sellIn, Quality = quality
                }
            };

            GildedRoseKata.GildedRose app = new GildedRoseKata.GildedRose(Items);
            app.UpdateQuality();

            Assert.Equal(quality - 2, Items[0].Quality);
        }
Esempio n. 7
0
        public void ReturnsTheSameQualityWhenTheNameIsAgedBrieAndQualityIsGreatestThan50(int sellIn, int quality)
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "Aged Brie", SellIn = sellIn, Quality = quality
                }
            };

            GildedRoseKata.GildedRose app = new GildedRoseKata.GildedRose(Items);
            app.UpdateQuality();

            Assert.Equal(quality, Items[0].Quality);
        }
Esempio n. 8
0
        public void ReturnsTheQualityPlusOneWhenTheNameIsAgedBrieAndValueOfSellInIsMinorThanOneAndQualityMinorThan50(int sellIn, int quality)
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "Aged Brie", SellIn = sellIn, Quality = quality
                }
            };

            GildedRoseKata.GildedRose app = new GildedRoseKata.GildedRose(Items);
            app.UpdateQuality();

            Assert.Equal(quality + 2, Items[0].Quality);
        }
Esempio n. 9
0
        public void ReturnsTheSameQualityWhenTheNameIsBackstagePassesToATAFKAL80ETCConcertAndValueOfSellInIsMinorOrEqualThanFiveAndQuantityIsHigherThan50(int sellIn, int quality)
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = sellIn, Quality = quality
                }
            };

            GildedRoseKata.GildedRose app = new GildedRoseKata.GildedRose(Items);
            app.UpdateQuality();

            Assert.Equal(quality, Items[0].Quality);
        }
Esempio n. 10
0
        public void ReturnsTheSameQualityWhenTheNameIsBackstagePassesToAtafkal80EtcConcertAndValueOfSellInIsBetweenThanTenAndSixAndQuantityIsGreatestThan50(int sellIn, int quality)
        {
            IList <Item> Items = new List <Item> {
                new Item {
                    Name = "Backstage passes to a TAFKAL80ETC concert", SellIn = sellIn, Quality = quality
                }
            };

            GildedRoseKata.GildedRose app = new GildedRoseKata.GildedRose(Items);
            app.UpdateQuality();

            Assert.Equal(quality, Items[0].Quality);
        }
Esempio n. 11
0
        public void BackstagePassesIncreaseInQualityBy35DaysOrLessBeforeTheConcert()
        {
            var originalQuality = 5;
            IList<Item> Items = new List<Item> {
                new Item {
                    Name = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn = 5,
                    Quality = originalQuality
                }
            };

            GildedRose app = new GildedRose(Items);
            app.UpdateQuality();

            Assert.AreEqual(originalQuality + 3, Items[0].Quality);
        }
Esempio n. 12
0
        public void AgedBrieActuallyIncreasesInQualityTheOlderItGets()
        {
            var originalQuality = 0;
            IList<Item> Items = new List<Item> {
                new Item {
                    Name = "Aged Brie",
                    SellIn = 1,
                    Quality = originalQuality
                }
            };

            GildedRose app = new GildedRose(Items);
            app.UpdateQuality();

            Assert.Greater(Items[0].Quality, originalQuality);
        }
Esempio n. 13
0
        public static void Main(string[] args)
        {
            System.Console.WriteLine("OMGHAI!");

            IList<Item> Items = new List<Item>{
                new Item {Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20},
                new Item {Name = "Aged Brie", SellIn = 2, Quality = 0},
                new Item {Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7},
                new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80},
                new Item {Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80},
                new Item
                {
                    Name = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn = 15,
                    Quality = 20
                },
                new Item
                {
                    Name = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn = 10,
                    Quality = 49
                },
                new Item
                {
                    Name = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn = 5,
                    Quality = 49
                },
                // this conjured item does not work properly yet
                new Item {Name = "Conjured Mana Cake", SellIn = 3, Quality = 6}
            };

            var app = new GildedRose(Items);

            for (var i = 0; i < 31; i++)
            {
                System.Console.WriteLine("-------- day " + i + " --------");
                System.Console.WriteLine("name, sellIn, quality");
                for (var j = 0; j < Items.Count; j++)
                {
                    System.Console.WriteLine(Items[j].Name + ", " + Items[j].SellIn + ", " + Items[j].Quality);
                }
                System.Console.WriteLine("");
                app.UpdateQuality();
            }
        }
Esempio n. 14
0
        public static void Main(string[] args)
        {
            Console.WriteLine("OMGHAI!");

            var items = GenerateItems();

            var app = new GildedRose(items);

            for (var i = 0; i < 31; i++)
            {
                Console.WriteLine("-------- day " + i + " --------");
                Console.WriteLine("name, sellIn, quality");
                for (var j = 0; j < items.Count; j++)
                {
                    System.Console.WriteLine(items[j].Name + ", " + items[j].SellIn + ", " + items[j].Quality);
                }
                Console.WriteLine("");
                app.UpdateItems();
            }
        }
Esempio n. 15
0
        public static void Main(string[] args)
        {
            Console.WriteLine("OMGHAI!");

            var data = DataHelper.GetSomeData();

            var app = new GildedRose(data);


            for (var i = 0; i < 31; i++)
            {
                Console.WriteLine("-------- day " + i + " --------");
                Console.WriteLine("name, sellIn, quality");
                for (var j = 0; j < data.Count; j++)
                {
                    System.Console.WriteLine(data[j].Name + ", " + data[j].SellIn + ", " + data[j].Quality);
                }
                Console.WriteLine("");
                app.UpdateQuality();
            }
        }
Esempio n. 16
0
        public void SulfurasBeingALegendaryItemHasNeverToBeSold()
        {
            var originalSellIn = 5;
            IList<Item> Items = new List<Item> {
                new Item {
                    Name = "Sulfuras, Hand of Ragnaros",
                    SellIn = originalSellIn,
                    Quality = 0
                }
            };

            GildedRose app = new GildedRose(Items);
            app.UpdateQuality();

            Assert.AreEqual(originalSellIn, Items[0].SellIn);
        }
        private Item CreateAndAdvanceSingleItem(string uniqueName, int sellInValue, int quality)
        {
            IList<Item> items = new List<Item> {new Item {Name = uniqueName, SellIn = sellInValue, Quality = quality}};
            GildedRose app = new GildedRose(items);
            app.UpdateQuality();

            return items[0];
        }
Esempio n. 18
0
        public void ConjuredItemsDegradeInQualityTwiceAsFastAsNormalItems()
        {
            var originalQuality = 10;
            IList<Item> Items = new List<Item> {
                new Item {
                    Name = "foo",
                    SellIn = 10,
                    Quality = originalQuality
                },
                new Item {
                    Name = "Conjured",
                    SellIn = 10,
                    Quality = originalQuality
                },
            };

            GildedRose app = new GildedRose(Items);
            app.UpdateQuality();

            var nonConjuredItemQualityDegradation =
                originalQuality - Items[0].Quality;

            var conjuredItemQualityDegradation =
                originalQuality - Items[1].Quality;

            Assert.AreEqual(
                nonConjuredItemQualityDegradation*2,
                conjuredItemQualityDegradation
            );
        }
Esempio n. 19
0
        public void DecreasesSellIn()
        {
            var originalSellInValue = 1;
            IList<Item> Items = new List<Item> {
                new Item {
                    Name = "foo",
                    SellIn = originalSellInValue,
                    Quality = 0
                }
            };

            GildedRose app = new GildedRose(Items);
            app.UpdateQuality();
            Assert.Less(Items[0].SellIn, originalSellInValue);
        }
Esempio n. 20
0
        public static void Main(string[] args)
        {
            Console.WriteLine("OMGHAI!");

            IList <DefaultItem> Items = new List <DefaultItem>
            {
                new StandardItem {
                    Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20
                },
                new IncreaseItem {
                    Name = "Aged Brie", SellIn = 2, Quality = 0
                },
                new StandardItem {
                    Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7
                },
                new LegendaryItem {
                    Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80
                },
                new LegendaryItem {
                    Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80
                },
                new ConcertItems
                {
                    Name    = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn  = 15,
                    Quality = 20
                },
                new ConcertItems
                {
                    Name    = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn  = 10,
                    Quality = 49
                },
                new ConcertItems
                {
                    Name    = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn  = 5,
                    Quality = 49
                },
                // this conjured item does not work properly yet
                new StandardItem {
                    Name = "Conjured Mana Cake", SellIn = 3, Quality = 6
                }
            };

            var app = new GildedRose(Items);


            for (var i = 0; i < 31; i++)
            {
                Console.WriteLine("-------- day " + i + " --------");
                Console.WriteLine("name, sellIn, quality");
                for (var j = 0; j < Items.Count; j++)
                {
                    System.Console.WriteLine(Items[j].Name + ", " + Items[j].SellIn + ", " + Items[j].Quality);
                }

                Console.WriteLine("");
                app.UpdateQuality();
            }
        }
Esempio n. 21
0
        private void RunApp()
        {
            var app = new GildedRose(_items);

            app.UpdateQuality();
        }
        public static void Main(string[] args)
        {
            Console.WriteLine("OMGHAI!");

            IList <Item> Items = new List <Item>
            {
                new Item {
                    Name = "+5 Dexterity Vest", SellIn = 10, Quality = 20
                },
                new Item {
                    Name = "Aged Brie", SellIn = 2, Quality = 0
                },
                new Item {
                    Name = "Elixir of the Mongoose", SellIn = 5, Quality = 7
                },
                new Item {
                    Name = "Sulfuras, Hand of Ragnaros", SellIn = 0, Quality = 80
                },
                new Item {
                    Name = "Sulfuras, Hand of Ragnaros", SellIn = -1, Quality = 80
                },
                new Item
                {
                    Name    = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn  = 15,
                    Quality = 20
                },
                new Item
                {
                    Name    = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn  = 10,
                    Quality = 49
                },
                new Item
                {
                    Name    = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn  = 5,
                    Quality = 49
                },
                new Item {
                    Name = "Mana Cake", SellIn = 3, Quality = 50, Conjured = true
                },
                new Item {
                    Name = "Aged Brie", SellIn = 10, Quality = 0, Conjured = true
                }
            };

            var app = new GildedRose(Items);

            for (var i = 0; i < 31; i++)
            {
                Console.WriteLine("-------- day " + i + " --------");
                Console.WriteLine("name, sellIn, quality");
                for (var j = 0; j < Items.Count; j++)
                {
                    Console.WriteLine(Items[j]);
                }
                Console.WriteLine("");
                app.UpdateQuality();
            }
        }
Esempio n. 23
0
        public void BackstagePassesQualityDropsTo0AfterTheConcert()
        {
            IList<Item> Items = new List<Item> {
                new Item {
                    Name = "Backstage passes to a TAFKAL80ETC concert",
                    SellIn = 0,
                    Quality = 10
                }
            };

            GildedRose app = new GildedRose(Items);
            app.UpdateQuality();

            Assert.AreEqual(0, Items[0].Quality);
        }
Esempio n. 24
0
        public void OnceSellDateHasPassedQualityDecreasesTwiceAsFast()
        {
            var originalQualityValue = 10;
            IList<Item> Items = new List<Item> {
                new Item {
                    Name = "foo",
                    SellIn = 1,
                    Quality = originalQualityValue
                },
                new Item {
                    Name = "foo",
                    SellIn = 0,
                    Quality = originalQualityValue
                }
            };

            GildedRose app = new GildedRose(Items);
            app.UpdateQuality();

            var nonPassedDecrease = originalQualityValue - Items[0].Quality;
            var passedDecrease = originalQualityValue - Items[1].Quality;

            Assert.AreEqual(nonPassedDecrease*2, passedDecrease);
        }
Esempio n. 25
0
        public void TheQualityOfAnItemIsNeverNegative()
        {
            IList<Item> Items = new List<Item> {
                new Item {
                    Name = "foo",
                    SellIn = 1,
                    Quality = 0
                }
            };

            GildedRose app = new GildedRose(Items);
            app.UpdateQuality();

            Assert.GreaterOrEqual(Items[0].Quality, 0);
        }
Esempio n. 26
0
        public void TheQualityOfAnItemIsNeverMoreThan50()
        {
            var originalQuality = 50;
            IList<Item> Items = new List<Item> {
                new Item {
                    Name = "Aged Brie",
                    SellIn = 1,
                    Quality = originalQuality
                }
            };

            GildedRose app = new GildedRose(Items);
            app.UpdateQuality();

            Assert.LessOrEqual(Items[0].Quality, originalQuality);
        }
Esempio n. 27
0
        public void SulfurasBeingALegendaryItemDoesNotDecreaseInQuality()
        {
            var originalQuality = 5;
            IList<Item> Items = new List<Item> {
                new Item {
                    Name = "Sulfuras, Hand of Ragnaros",
                    SellIn = 0,
                    Quality = originalQuality
                }
            };

            GildedRose app = new GildedRose(Items);
            app.UpdateQuality();

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