Skip to content

Commit

Permalink
Add test for object posting notification
Browse files Browse the repository at this point in the history
  • Loading branch information
pengwp committed Sep 20, 2018
1 parent 619a65b commit dea4316
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions Tests/Tests/AFNetworkReachabilityManagerTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,15 @@ - (void)testDomainReachabilityBlock {
[self verifyReachabilityStatusBlockGetsCalledWithManager:self.domainReachability];
}

- (void)testDifferentReachabilityManagerNotificationPostsAndGets {
[self verifyReachabilityNotificationPostsAndGetsConsistenceWithPostsManager:self.domainReachability getsManager:self.addressReachability];
}

- (void)testSameReachabilityManagerNotificationPostsAndGets {
[self verifyReachabilityNotificationPostsAndGetsConsistenceWithPostsManager:self.addressReachability getsManager:self.addressReachability];
}

- (void)verifyReachabilityNotificationPostsAndGetsConsistenceWithPostsManager:(AFNetworkReachabilityManager *)postsManager getsManager:(AFNetworkReachabilityManager *)getsManager {
BOOL isSameReachabilityManager = [postsManager isEqual:getsManager];
- (void)testObjectPostingReachabilityManagerNotification {
[self expectationForNotification:AFNetworkingReachabilityDidChangeNotification
object:nil
handler:^BOOL(NSNotification *note) {
BOOL isSameReachabilityManagerPostsAndGets = [note.object isEqual:getsManager];
return isSameReachabilityManager == isSameReachabilityManagerPostsAndGets;
object:self.domainReachability
handler:^BOOL(NSNotification *notification) {
BOOL isObjectPostingNotification = [notification.object isEqual:self.domainReachability];
return isObjectPostingNotification;
}];

[postsManager startMonitoring];
[self.domainReachability startMonitoring];

[self waitForExpectationsWithCommonTimeout];
}
Expand Down

0 comments on commit dea4316

Please sign in to comment.