title: How to write XCTestCase for asynchronized method?
body: <p>I'm working on a unit test for one of my model which is using asynchronized call to my rest api.The method used to request my API is like this:</p>
  
  <pre><code>requestOnComplete:(void(^)())complete onError:(void(^)(NSString* errMsg))fail;
  </code></pre>
  
  <p>In my test case:</p>
  
  <pre><code>-(void)testMyApiCall
  {
      [myObj requestOnComplete:^{
  
          XCTAssertTrue(YES,@"Success");
  
      } onError:^(NSString *errorString) {
  
          XCTFail(@"Failed.%@", errorString);
  
      }];
  }
  </code></pre>
  
  <p>As I expected, this test always pass because of the asynchronized call. Can anybody advise on this issue? Thanks.</p>