I am trying to write test cases and trying to access a method which returns Single object. For this I want to use toBlocking but I am not able to access it and getting following error:
Value of type 'Single<[Property]>' (aka 'PrimitiveSequence>') has no member 'toBlocking'
Following is my code
do {
let property = try viewModel.getPropertyList(city: "1530")
.toBlocking()
.single()
XCTAssertNotNil(property)
} catch {
XCTFail("Get user settings failed")
}
Already imported following frameworks:
import RxCocoa
import RxSwift
import XCTest
You need to
import RxBlocking
too! if it raises error then you should addRxBlocking
to your Test target in your package manager.For example in
Pod
you should have something like this in yourPod
file :