jeudi 5 mars 2015

How to Unit Test method that calls NSDate()?

I'm currently using Swift.


My question is simple, how do you unit test a method that create an object in a database with NSDate() as a property?


The problem is that on my assert I'll create a new NSDate() like this:



let expectedObject = Object(data: NSDate())
XCTAssertEqual(database.objects(), [expectedObject])


And the assert will fail because the 2 NSDates are slightly different.


Thank you.


Aucun commentaire:

Enregistrer un commentaire