Closed hugobast closed 7 years ago
Use something like this
_ = yourServiceMock.when().call(withReturnValue: yourServiceMock.login("dummyLoginName", password: "dummyPassword", webServiceResponse: YourWebServiceResponseStub()),
andArgumentMatching: [Anything(), Anything(), Anything()]).thenDo {
(args: [Any?]) -> Void in
(args[2] as! YourWebServiceResponseHandler).success(200, responseObject: loginObjectToBeReturnedOnAPICall)
// or may be for failure you can use
// _ = (args[2] as! `YourWebServiceResponseHandler).failure(401,` error: errorDetails)
}
I'm curious to know what approach you recommend when trying to verify mocks in an async setup. I'm using Quick/Nimble if that matters.