mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
35 lines
1.4 KiB
Swift
35 lines
1.4 KiB
Swift
//
|
|
// TestSellInModificationRule.swift
|
|
// GildedRose
|
|
//
|
|
// Created by Lucas van Dongen on 23/11/2020.
|
|
//
|
|
|
|
@testable import GildedRose
|
|
import XCTest
|
|
|
|
class TestSellInModificationRule: XCTestCase {
|
|
private let regularItem = Item(name: "Regular Item", sellIn: 1, quality: 5)
|
|
private let backstagePassesItem = Item(name: "Backstage passes to a TAFKAL80ETC concert", sellIn: 1, quality: 0)
|
|
private let brieItem = Item(name: "Aged Brie", sellIn: 2, quality: 0)
|
|
private let sulfuras = Item(name: "Sulfuras, Hand of Ragnaros", sellIn: 0, quality: 50)
|
|
|
|
//- All items have a SellIn value which denotes the number of days we have to sell the item
|
|
func testRuleSelection() {
|
|
XCTAssertEqual(QualityModificationRule.rule(for: regularItem), .regular)
|
|
XCTAssertEqual(QualityModificationRule.rule(for: backstagePassesItem), .qualityIncreasesFasterBeforeExpireThenDropsToZero)
|
|
XCTAssertEqual(QualityModificationRule.rule(for: brieItem), .increasesQuality)
|
|
XCTAssertEqual(QualityModificationRule.rule(for: sulfuras), .legendary)
|
|
}
|
|
|
|
func testApplyQualityThresholds() {
|
|
XCTAssertEqual(QualityModificationRule .applyQualityThresholds(to: -1), 0)
|
|
XCTAssertEqual(QualityModificationRule.applyQualityThresholds(to: 51), 50)
|
|
XCTAssertEqual(QualityModificationRule.applyQualityThresholds(to: 24), 24)
|
|
}
|
|
|
|
func testIsRegularItemExpired() {
|
|
|
|
}
|
|
}
|