mercredi 7 janvier 2015

XCTAssertEqual with Optional (not Equatable)

I would like to make the following in assertion:



XCTAssertEqual(sut.dataSource?.delegate, userInterface, "Data source's delegate should be the user interface")


The properties dataSource and delegate are Optionals. I tried unwrapping them with let assignments, but it essentially boils down to either



Generic parameter 'T' cannot be bound to non-@objc protocol type 'FetchedResultsControllerDataSourceDelegate'


or



Type 'FetchedResultsControllerDataSourceDelegate?' does not conform to protocol 'Equatable'


What can I do to assert that the optional relationships are properly set up?


Aucun commentaire:

Enregistrer un commentaire