mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-16 06:51:27 +00:00
Add test cases for normal item quality and sellIn
This commit is contained in:
parent
bb769e690b
commit
4f26d09fa3
@ -30,18 +30,37 @@ class GildedRoseTest {
|
|||||||
// At the end of each day our system lowers both values (Quality and SellIn) for every item
|
// At the end of each day our system lowers both values (Quality and SellIn) for every item
|
||||||
@Test
|
@Test
|
||||||
public void testNormalItemQualityAndSellInDecrease() {
|
public void testNormalItemQualityAndSellInDecrease() {
|
||||||
|
app.updateQuality();
|
||||||
|
assertEquals(19, items[0].quality);
|
||||||
|
assertEquals(9, items[0].sellIn);
|
||||||
|
|
||||||
|
app.updateQuality();
|
||||||
|
assertEquals(18, items[0].quality);
|
||||||
|
assertEquals(8, items[0].sellIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The Quality of an item is never negative
|
// The Quality of an item is never negative, quality of a normal item is decreasing each day
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
|
||||||
public void testNormalItemQualityCannotGoNegative() {
|
public void testNormalItemQualityCannotGoNegative() {
|
||||||
|
for(int i=0; i<10; i++) {
|
||||||
|
app.updateQuality();
|
||||||
|
}
|
||||||
|
assertEquals(0, items[2].quality);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Once the sell by date has passed, Quality degrades twice as fast
|
// Once the sell by date has passed, Quality degrades twice as fast
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
|
||||||
public void testQualityDegradesTwiceAfterSellPassed() {
|
public void testQualityDegradesTwiceAfterSellPassed() {
|
||||||
|
for(int i=0; i<10; i++) {
|
||||||
|
app.updateQuality();
|
||||||
|
}
|
||||||
|
assertEquals(10, items[0].quality);
|
||||||
|
|
||||||
|
app.updateQuality();
|
||||||
|
assertEquals(8, items[0].quality);
|
||||||
|
|
||||||
|
app.updateQuality();
|
||||||
|
assertEquals(6, items[0].quality);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user