Created
November 8, 2013 10:23
-
-
Save MattesGroeger/7369109 to your computer and use it in GitHub Desktop.
I just re-factored this OCUnit code to Kiwi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[[user1Dict[@"highscores"] valueForKey:@"fb_id"] should] contain:fbId_user2]; | |
[[[user2Dict[@"highscores"] valueForKey:@"fb_id"] should] contain:fbId_user1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDictionary *iphoneDictInIpadDict = nil; | |
NSDictionary *ipadDictInIphoneDict = nil; | |
for (NSDictionary *dict in user2Dict[@"highscores"]) | |
{ | |
STAssertTrue(dict[@"fb_id"] != nil, @"Has to contain fb_id"); | |
if ([dict[@"fb_id"] isEqual:fbId_user1]) | |
{ | |
iphoneDictInIpadDict = dict; | |
} | |
} | |
for (NSDictionary *dict in user1Dict[@"highscores"]) | |
{ | |
STAssertTrue(dict[@"fb_id"] != nil, @"Has to contain fb_id"); | |
if ([dict[@"fb_id"] isEqual:fbId_user2]) | |
{ | |
ipadDictInIphoneDict = dict; | |
} | |
} | |
STAssertTrue(iphoneDictInIpadDict != nil, @"Should have retrieved dictionary."); | |
STAssertTrue(ipadDictInIphoneDict != nil, @"Should have retrieved dictionary."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Even without Kiwi, you could accomplish something also as short using MACollectionUtilities:
import "MACollectionUtilities.h"
STAssertTrue (MATCH (user2Dict[@"highscores"], [[obj objectForKey:@"fb_id"] isEqualTo:fbId_user1])), @"Should have retrieved dictionary.");
STAssertTrue (MATCH (user1Dict[@"highscores"], [[obj objectForKey:@"fb_id"] isEqualTo:fbId_user2])), @"Should have retrieved dictionary.");