fixed test cases.

After Xcode 6 beta 3, unit test was not working.
In this fix, XCTestExpectation is used to wait for asynchronous tasks.