FRANotificationHandlerTest.m revision 1d464fc27913cfdeb6e09c8ab5d06ada64f94d55
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings * The contents of this file are subject to the terms of the Common Development and
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings * Distribution License (the License). You may not use this file except in compliance with the
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings * specific language governing permission and limitations under the License.
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings * When distributing Covered Software, include this CDDL Header Notice in each file and include
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings * Header, with the fields enclosed by brackets [] replaced by your own identifying
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings * information: "Portions copyright [year] [name of copyright owner]".
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings * Copyright 2016 ForgeRock AS.
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings#import "FRAIdentityDatabase.h"
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings#import "FRAIdentity.h"
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings#import "FRAPushMechanism.h"
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings#import "FRANotificationHandler.h"
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings#import "FRAIdentityModel.h"
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings@interface FRANotificationHandlerTest : XCTestCase
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbingsstatic NSString *const TEST_USERNAME = @"Alice";
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings database = [[FRAIdentityDatabase alloc] init];
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings identityModel = [[FRAIdentityModel alloc] initWithDatabase:database];
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings testIdentity = [FRAIdentity identityWithDatabase:database accountName:TEST_USERNAME issuer:@"ForgeRock" image:nil];
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings testMechanism = [[FRAPushMechanism alloc] initWithDatabase:database];
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings handler = [[FRANotificationHandler alloc] initWithDatabase:database identityModel:identityModel];
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings @"mechanismUID": [NSString stringWithFormat: @"%ld", (long)testMechanismUid],
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings FRAMechanism *mechanismResult = [identityModel mechanismWithId:testMechanismUid];
1d464fc27913cfdeb6e09c8ab5d06ada64f94d55Ken Stubbings XCTAssertEqual([[mechanismResult notifications] count], 1, "Mechanism did not contain expected Notification");