Exemplo n.º 1
0
 def test_quality_never_over_50_and_under_0(self):
     items = [
         Item(name="+5 Dexterity Vest", sell_in=10, quality=0),
         Item(name="Aged Brie", sell_in=2, quality=50),
         Item(name="Elixir of the Mongoose", sell_in=5, quality=0),
         Item(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=50),
         Item(name="Sulfuras, Hand of Ragnaros", sell_in=-1, quality=50),
         Item(name="Backstage passes to a TAFKAL80ETC concert",
              sell_in=15,
              quality=50),
         Item(name="Backstage passes to a TAFKAL80ETC concert",
              sell_in=10,
              quality=50),
         Item(name="Backstage passes to a TAFKAL80ETC concert",
              sell_in=-5,
              quality=0),
         Item(name="Conjured Mana Cake", sell_in=1, quality=0),
     ]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     gilded_rose.update_quality()
     gilded_rose.update_quality()
     gilded_rose.update_quality()
     newItemsValuesQuality = [items[x].quality for x in range(9)]
     self.assertSequenceEqual([0, 50, 0, 50, 50, 50, 50, 0, 0],
                              newItemsValuesQuality)
Exemplo n.º 2
0
 def test_both_values_lower_next_day(self):
     items = [
         Item(name="+5 Dexterity Vest", sell_in=10, quality=10),
         Item(name="Elixir of the Mongoose", sell_in=5, quality=5),
     ]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(9, items[0].sell_in)
     self.assertEquals(9, items[0].quality)
     self.assertEquals(4, items[1].sell_in)
     self.assertEquals(4, items[1].quality)
Exemplo n.º 3
0
 def test_sulfuras_not_changes(self):
     items = [
         Item(name="Sulfuras, Hand of Ragnaros", sell_in=10, quality=30),
         Item(name="Sulfuras, Hand of Ragnaros", sell_in=-3, quality=20),
     ]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     gilded_rose.update_quality()
     gilded_rose.update_quality()
     gilded_rose.update_quality()
     self.assertSequenceEqual([10, 30, -3, 20], [
         items[0].sell_in, items[0].quality, items[1].sell_in,
         items[1].quality
     ])
Exemplo n.º 4
0
 def test_passes_quality_raise_stronger(self):
     items = [
         Item(name='Backstage passes to a TAFKAL80ETC concert',
              sell_in=6,
              quality=10)
     ]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     gilded_rose.update_quality()
     self.assertEqual(15, items[0].quality)
Exemplo n.º 5
0
 def test_quality_value_change(self):
     items = [
         Item(name="+5 Dexterity Vest", sell_in=10, quality=20),
         Item(name="Aged Brie", sell_in=2, quality=0),
         Item(name="Elixir of the Mongoose", sell_in=5, quality=7),
         Item(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80),
         Item(name="Sulfuras, Hand of Ragnaros", sell_in=-1, quality=80),
         Item(name="Backstage passes to a TAFKAL80ETC concert",
              sell_in=15,
              quality=20),
         Item(name="Backstage passes to a TAFKAL80ETC concert",
              sell_in=10,
              quality=49),
         Item(name="Backstage passes to a TAFKAL80ETC concert",
              sell_in=5,
              quality=49),
         Item(name="Conjured Mana Cake", sell_in=1, quality=15),
     ]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     newItemsValuesQuality = [items[x].quality for x in range(9)]
     self.assertSequenceEqual([19, 1, 6, 80, 80, 21, 50, 50, 13],
                              newItemsValuesQuality)
Exemplo n.º 6
0
 def test_lower_sellIn_value_items(self):
     items = [
         Item(name="+5 Dexterity Vest", sell_in=10, quality=20),
         Item(name="Aged Brie", sell_in=2, quality=0),
         Item(name="Elixir of the Mongoose", sell_in=5, quality=7),
         Item(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80),
         Item(name="Sulfuras, Hand of Ragnaros", sell_in=-1, quality=80),
         Item(name="Backstage passes to a TAFKAL80ETC concert",
              sell_in=15,
              quality=20),
         Item(name="Backstage passes to a TAFKAL80ETC concert",
              sell_in=10,
              quality=49),
         Item(name="Backstage passes to a TAFKAL80ETC concert",
              sell_in=5,
              quality=49),
         Item(name="Conjured Mana Cake", sell_in=1, quality=15),
     ]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     gilded_rose.update_quality()
     newItemsValuesSellIn = [items[x].sell_in for x in range(9)]
     self.assertSequenceEqual([8, 0, 3, 0, -1, 13, 8, 3, -1],
                              newItemsValuesSellIn)
 def test_aged_brie_before_sell_date_increase_by_one(self):
     item = [Item("Aged Brie", 10, 40)]
     update_quality(item)
     self.assertEqual(41, item[0].quality)
 def test_backstage_pass_10_days_before_concert(self):
     items = [Item('Backstage passes', 10, 45)]
     update_quality(items)
     self.assertEqual(47, items[0].quality)
 def test_backstage_pass_less_than_5_days_before_concert(self):
     items = [Item('Backstage passes', 5, 45)]
     update_quality(items)
     self.assertEqual(48, items[0].quality)
Exemplo n.º 10
0
 def test_mana_cake_quality_decreases_twice_before_sellIn(self):
     items = [Item(name="Conjured Mana Cake", sell_in=4, quality=15)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(13, items[0].quality)
Exemplo n.º 11
0
 def test_mana_cake_quality_decreases_four_times_after_sellIn(self):
     items = [Item(name="Conjured Mana Cake", sell_in=-1, quality=15)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(11, items[0].quality)
 def test_backstage_pass_after_concert(self):
     items = [Item('Backstage passes', -1, 49)]
     update_quality(items)
     self.assertEqual(0, items[0].quality)
Exemplo n.º 13
0
 def test_aged_brie_decreases_sellIn(self):
     items = [Item(name="Aged Brie", sell_in=2, quality=30)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     self.assertEquals(1, items[0].sell_in)
Exemplo n.º 14
0
 def test_once_the_sellIn_passed_quality_degrades_twice(self):
     items = [Item(name="Elixir of the Mongoose", sell_in=-1, quality=7)]
     gilded_rose = GildedRose(items)
     gilded_rose.update_quality()
     gilded_rose.update_quality()
     self.assertEqual(3, items[0].quality)
 def test_aged_brie_quality_increases_by_two_after_sell_date(self):
     items = [Item("Aged Brie", -1, 47)]
     update_quality(items)
     self.assertEqual(49, items[0].quality)
 def test_conjured_before_sell_date(self):
     items = [Item('Conjured', 10, 20)]
     update_quality(items)
     self.assertEqual(18, items[0].quality)
 def test_after_sell_date_quality_decreases_by_2(self):
     items = [Item('something', -1, 35)]
     update_quality(items)
     self.assertEqual((-2, 33), (items[0].sell_in, items[0].quality))
 def test_sulfuras_never_changes(self):
     items = [Item('Sulfuras', 10, 40)]
     update_quality(items)
     self.assertEqual((10, 40), (items[0].sell_in, items[0].quality))