mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-05-19 12:22:23 +08:00
* 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
38 lines
1.4 KiB
Objective-C
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
|