Slide 33
Slide 33 text
͜Ε͘Β͍ͳΒଥڠ͢Δʁ
33
Copyright (C) DeNA Co.,Ltd. All Rights Reserved.
class MockCock: CockProtocol {
var cockRamenCallCount: Int = 0
var cockRamenLastBowls: Int = 0
var cockRamenCallReturn: [Ramen] = []
var cockRamenLastSoup: Soup = .ে༉
func cockRamen(bowls: Int, soup: Soup) -> [Ramen] {
cockRamenCallCount += 1
cockRamenLastBowls = bowls
cockRamenLastSoup = soup
return cockRamenCallReturn
}
}
class WaiterTests: XCTestCase {
func test_order() {
let mock = MockCock()
mock.cockRamenCallReturn = [Ramen(soup: .ে༉), Ramen(soup: .ຯḩ)]
let results = Waiter(cock: mock).order()
XCTAssertEqual(results.count, 2)
XCTAssertTrue(results.contains { $0.soup == .ে༉ })
XCTAssertTrue(results.contains { $0.soup == .ຯḩ })
XCTAssertEqual(mock.cockRamenCallCount, 1)
XCTAssertEqual(mock.cockRamenLastBowls, 2)
XCTAssertEqual(mock.cockRamenLastSoup, .ে༉)
}
}