Files
RestKit/Tests/Logic/Support/RKMutableBlockDictionaryTest.m
Blake Watters 4142ffdb42 Reorganization and cleanups of Unit Tests
* Reorganized tests to accommodate split into Logic & Application.
* Eliminated 'Spec' naming in favor of 'Test' as the suite is entirely based on SenTest.
* Pulled majority of testing support classes up into the library and documented them.
* Introduced RKApplicationTests app for running the RKTableController UI tests
2012-02-10 17:32:23 -05:00

38 lines
1.4 KiB
Objective-C

//
// RKMutableBlockDictionaryTest.m
// RestKit
//
// Created by Blake Watters on 8/22/11.
// Copyright (c) 2011 RestKit. All rights reserved.
//
#import "RKTestEnvironment.h"
#import "RKMutableBlockDictionary.h"
@interface RKMutableBlockDictionaryTest : RKTestCase
@end
@implementation RKMutableBlockDictionaryTest
- (void)testLetYouAssignABlockToTheDictionary {
RKMutableBlockDictionary* blockDictionary = [[RKMutableBlockDictionary new] autorelease];
[blockDictionary setValueWithBlock:^id{ return @"Value from the block!"; } forKey:@"theKey"];
assertThat([blockDictionary valueForKey:@"theKey"], is(equalTo(@"Value from the block!")));
}
- (void)testLetYouUseKVC {
RKMutableBlockDictionary* blockDictionary = [[RKMutableBlockDictionary new] autorelease];
[blockDictionary setValue:@"a value" forKey:@"a key"];
assertThat([blockDictionary valueForKey:@"a key"], is(equalTo(@"a value")));
}
- (void)testLetYouAccessABlockValueUsingAKeyPath {
RKMutableBlockDictionary* blockDictionary = [[RKMutableBlockDictionary new] autorelease];
[blockDictionary setValueWithBlock:^id{ return @"Value from the block!"; } forKey:@"theKey"];
NSDictionary* otherDictionary = [NSDictionary dictionaryWithObject:blockDictionary forKey:@"dictionary"];
assertThat([otherDictionary valueForKeyPath:@"dictionary.theKey"], is(equalTo(@"Value from the block!")));
}
@end