/**
* All items form etalonDictionary should be in dictionary. Extra keys from dictionary should be ignored
*/
-(BOOL)isEtalonDictionary:(NSDictionary *)etalonDictionary sameAs:(NSDictionary *)dictionary{
BOOL res = NO;
for (id item in etalonDictionary){
NSObject *secondObject = [dictionary objectForKey:item];
if (secondObject == nil)
return NO;
else{
NSObject *value = [etalonDictionary objectForKey:item];
if ([value isKindOfClass:[NSString class]]){
NSString *string = (NSString *) value;
if ([string isEqualToString:(NSString *) secondObject]){
res = YES;
} else {
return NO;
}
}
if ([value isKindOfClass:[NSNumber class]]){
NSNumber *number = (NSNumber *) value;
if([number isEqualToNumber:(NSNumber *) secondObject])
res = YES;
else
return NO;
}
if ([value isKindOfClass:[NSDictionary class]]){
res = [self isEtalonDictionary:(NSDictionary *) value sameAs:(NSDictionary *) secondObject];
if (!res){
return NO;
}
}
}
}
return res;
}