mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Added tests
This commit is contained in:
parent
7a7102c9cb
commit
8f2fec5cd8
@ -9,13 +9,25 @@
|
||||
import XCTest
|
||||
|
||||
class GildedRoseBrieTests: XCTestCase {
|
||||
func test_updateQuality_agedBrieQuality_increasesInAgeAfterSellByDate() throws {
|
||||
func test_updateQuality_agedBrieQuality_increasesInQuality() throws {
|
||||
let items = [Item(name: "Aged Brie", sellIn: 1, quality: 4)]
|
||||
let app = GildedRose(items: items)
|
||||
app.updateQuality()
|
||||
XCTAssertEqual(app.items[0].quality, 5)
|
||||
}
|
||||
|
||||
func test_updateQuality_agedBrieQuality_increasesInAgeAfterSellByDate() throws {
|
||||
let items = [Item(name: "Aged Brie", sellIn: 0, quality: 5)]
|
||||
let app = GildedRose(items: items)
|
||||
app.updateQuality()
|
||||
XCTAssertEqual(app.items[0].quality, 7)
|
||||
}
|
||||
|
||||
func test_updateQuality_agedBrieQuality_shouldntGoOver50Quality() throws {
|
||||
let items = [Item(name: "Aged Brie", sellIn: 0, quality: 50)]
|
||||
let app = GildedRose(items: items)
|
||||
app.updateQuality()
|
||||
XCTAssertEqual(app.items[0].quality, 50)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ class GildedRoseTests: XCTestCase {
|
||||
}
|
||||
|
||||
func test_updateQuality_itemQuality_shouldntBecomeNegativeAfterPassingSellByDate() throws {
|
||||
let items = [Item(name: "foo", sellIn: 0, quality: 1)]
|
||||
let items = [Item(name: "foo", sellIn: 0, quality: 0)]
|
||||
let app = GildedRose(items: items)
|
||||
app.updateQuality()
|
||||
XCTAssertEqual(app.items[0].quality, 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user