35 ARService *service = [[
ARService alloc] initWithSite:[NSURL URLWithString:@"http://localhost"] elementName:@"resource"];
36 [
self setResource:[[
ARResource alloc] initWithService:service]];
37 [[
self resource] setValue:[NSNumber numberWithInt:0] forKey:@"zero"];
42 [
self setResource:nil];
47 STAssertEqualObjects([NSNumber numberWithInt:0], [[
self resource] valueForKey:
@"zero"], nil);
52 [[
self resource] setValue:@"" forKey:@"key"];
53 STAssertEqualObjects(
@"", [[
self resource] valueForKey:
@"key"], nil);
56 STAssertEqualObjects([NSNull null], [[
self resource] valueForKey:
@"key"], nil);
61 [[
self resource] setValue:@"123" forKey:@"TheKey"];
62 STAssertEqualObjects(
@"123", [[[
self resource] attributes] objectForKey:
@"the_key"], nil);
67 [[
self resource] setValue:@"abc" forKey:@"KeyA"];
68 [[
self resource] setValue:@"def" forKey:@"KeyB"];
70 NSDictionary *shouldBeValuesForKeys = [NSDictionary dictionaryWithObjectsAndKeys:@"abc", @"KeyA", @"def", @"KeyB", nil];
71 STAssertEqualObjects(shouldBeValuesForKeys, valuesForKeys, nil);
76 NSDictionary *valuesForKeys = [NSDictionary dictionaryWithObjectsAndKeys:@"abc", @"KeyABC", @"xyz", @"KeyXYZ", [NSNull null], @"Null", nil];
79 STAssertEqualObjects([attributes objectForKey:
@"key_abc"],
@"abc", nil);
80 STAssertEqualObjects([attributes objectForKey:
@"key_xyz"],
@"xyz", nil);
81 STAssertEqualObjects([attributes objectForKey:
@"null"], [NSNull null], nil);