forked from BlocksKit/BlocksKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMFMessageComposeViewControllerBlocksKitTest.m
More file actions
43 lines (34 loc) · 1.18 KB
/
Copy pathMFMessageComposeViewControllerBlocksKitTest.m
File metadata and controls
43 lines (34 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// MFMessageComposeViewControllerBlocksKitTest.m
// BlocksKit Unit Tests
#import "MFMessageComposeViewControllerBlocksKitTest.h"
@implementation MFMessageComposeViewControllerBlocksKitTest {
MFMessageComposeViewController *_subject;
BOOL delegateWorked;
}
- (BOOL)shouldRunOnMainThread {
return YES;
}
- (void)setUp {
_subject = [MFMessageComposeViewController new];
}
- (void)tearDown {
[_subject release];
}
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {
delegateWorked = YES;
}
- (void)testCompletionBlock {
if (![MFMessageComposeViewController canSendText])
return;
delegateWorked = NO;
__block BOOL blockWorked = NO;
_subject.messageComposeDelegate = self;
_subject.completionBlock = ^(MFMessageComposeViewController *controller, MessageComposeResult result){
blockWorked = YES;
};
[[_subject dynamicDelegateForProtocol:@protocol(MFMessageComposeViewControllerDelegate)] messageComposeViewController:_subject didFinishWithResult:MessageComposeResultSent];
GHAssertTrue(delegateWorked, @"Delegate method not called.");
GHAssertTrue(blockWorked, @"Block handler not called.");
}
@end