I have some Objective-C [i-os] code that I would like to run unit tests over using XCode. It accesses different metadata depending on the type of device, using:
[[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad
The problem I have is that when I run the Unit Tests, this result is always true. Ideally, it would be great to be able to set it as the test runs.
The way I guess it could be done is by creating a class that encapsulates the device check and mock that for the test. But I thought it might be worth seeing if there are any better solutions.
For reference, a nice blog post with many links, the Apple Unit testing guide and Unit test sample code project.