0
我正在創建一個測試用例,它測試委託函數didDisconnectwithError是否可以調用,用於TVIroom類。爲此我需要通過委託功能blankempty TVI房間對象。但是,委託函數不接受零值作爲輸入,並且不允許強制解包。 如何將TVIroom對象傳遞給委託進行測試,如果它不能爲零? 這裏是我到目前爲止的代碼:爲代理功能測試製作一個空白(非零)tviRoom對象
func testDisconnectCalled_usedWhileSwitching_AndwhileExplicitlyDisconnecting() {
let delegate = RoomTestsDelegate()
let room: TVIRoom? = nil
let error: Error? = nil
delegate.room(room, didDisconnectWithError: error)
expect(delegate.notifiedAboutDidDisconnect).toEventually(beTrue(), timeout: 1)
}
我該怎麼做?一些更多的見解將會有所幫助 – CodeMaker