I need to create some unit test for delegate/protocol call backs. Here is an example of the implementation I'm trying to test:
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)
}
}
I haven't found a create the unit test (XCTest) to test the delegate response.
I'll really appreciate your help.