【发布时间】:2017-09-24 13:17:49
【问题描述】:
我需要为委托/协议回调创建一些单元测试。这是我正在尝试测试的实现示例:
protocol SomethingWithNumbersDelegate: class {
func somethingWithDelegate(results:Int)
}
class SomethingWithNumbers {
var delegate: SomethingWithNumbersDelegate? = nil
func doAsyncStuffWithNumbers(number:Int) {
var numbers = Int()
/*
doing some with the input
*/
self.delegate?.somethingWithDelegate(results: numbers)
}
}
我还没有找到一个创建单元测试 (XCTest) 来测试委托响应。
非常感谢您的帮助。
【问题讨论】:
标签: ios swift xcode delegates xctest