¡@

Home 

2014/10/15 ¤U¤È 10:13:51

iphone Programming Glossary: self.thelock

How to unit test asynchronous APIs?

http://stackoverflow.com/questions/2162213/how-to-unit-test-asynchronous-apis

create the semaphore and lock it once before we start the async operation NSConditionLock tl NSConditionLock new self.theLock tl tl release start the async operation self.testState 0 conn doItAsyncWithDelegate self now lock the semaphore which will.. operation self.testState 0 conn doItAsyncWithDelegate self now lock the semaphore which will block this thread until self.theLock unlockWithCondition 1 gets invoked self.theLock lockWhenCondition 1 make sure the async callback did in fact happen by checking.. self now lock the semaphore which will block this thread until self.theLock unlockWithCondition 1 gets invoked self.theLock lockWhenCondition 1 make sure the async callback did in fact happen by checking whether it modified a variable STAssertTrue..