0
ローカルの通知を追加するアプリケーションを作成しています。 これは私のテストですOCMockito/OCHamcrestの配列にオブジェクトプロパティが含まれていることを確認します。
- (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がにあり、フレンズの配列に含まれていないかどうかを確認する必要があります。 これには方法がありますか?
「alertBody」はどのようなものになるでしょうか? '@" a "と同じですか? –
このシナリオでは友人がいませんので、** alertBody **は** withoutFriends **配列のランダム値になります。 – milczi