我正在创建一个应用程序,它添加了一些本地通知。这是我的测试
- (void)testFirstLogin {
//some initials array
NSArray *withoutFriends = @[@"a", @"b", @"c", @"e", @"f"];
NSArray *withFriends = @[@"v", @"w", @"x", @"y", @"z"];
//my service which add local notifications
LocalNotificationService *service = [LocalNotificationService sharedInstance];
service.lastLoginDate = nil;
//UIApplication mock
UIApplication *application = mock([UIApplication class]);
service.applictation = application;
//method which adds notifications
[service addNotificationScheduleFirstLoginWithNoFriendsArray:withoutFriends friendsExistArray:withFriends];
//In this method I create UILocalNotification
/*
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.alertBody = text;
*/
//and add it to schedule
//[self.applictation scheduleLocalNotification:localNotification];
[verifyCount(application, times(1)) scheduleLocalNotification:anything()]; }这是正确的,验证就是成功。但是,我需要验证我的UILocalNotification对象属性alertBody是否在UILocalNotification数组中。有办法吗?
发布于 2016-03-24 16:55:54
有一个matcher isIn,我看到的是从自述中失踪。与hasProperty匹配器一起,我们可以编写:
[verifyCount(application, times(1)) scheduleLocalNotification:hasProperty(@"alertBody", isIn(withoutFriends))];https://stackoverflow.com/questions/36171951
复制相似问题