Hey All,
I want to write a unit test for my data model and ensure that it's parsing correctly. My approach is to make a JSON dictionary that has keys that mimic the server response and then manually set a model object with the same values as the JSON dictionary, then compare the two to ensure that the values are getting set appropriately. The problem is the XCTest is saying that the models aren't equal, even though they are (I iterated through each values and compared the values manually and got matching results). I double checked and they have the same values. The model inherits from NSObject so I don't need to implement equatable.
1. Does XCTAssertEqual check memory address rather than values?
2. Is there a way to compare these models without having to manually compare each value? e.g. model1.obj1 == model2.ob1
I want to write a unit test for my data model and ensure that it's parsing correctly. My approach is to make a JSON dictionary that has keys that mimic the server response and then manually set a model object with the same values as the JSON dictionary, then compare the two to ensure that the values are getting set appropriately. The problem is the XCTest is saying that the models aren't equal, even though they are (I iterated through each values and compared the values manually and got matching results). I double checked and they have the same values. The model inherits from NSObject so I don't need to implement equatable.
1. Does XCTAssertEqual check memory address rather than values?
2. Is there a way to compare these models without having to manually compare each value? e.g. model1.obj1 == model2.ob1