pEpObjCTests/PepTests.m
author Dirk Zimmermann <dz@pep.security>
Fri, 06 Sep 2019 11:03:27 +0200
branchIOS-1784
changeset 1225 6d89f5f624db
parent 738 7ac89df4a502
permissions -rw-r--r--
IOS-1784 Separate concerns.
dirk@139
     1
//
dirk@139
     2
//  PepTests.m
dirk@139
     3
//  pEpiOSAdapter
dirk@139
     4
//
dirk@139
     5
//  Created by Dirk Zimmermann on 01/08/16.
dirk@139
     6
//  Copyright © 2016 p≡p. All rights reserved.
dirk@139
     7
//
dirk@139
     8
dirk@139
     9
#import <XCTest/XCTest.h>
dirk@139
    10
dirk@189
    11
#import "PEPObjCAdapter.h"
dirk@189
    12
#import "PEPSession.h"
dirk@189
    13
#import "PEPLanguage.h"
dirk@139
    14
dirk@139
    15
@interface PepTests : XCTestCase
dirk@139
    16
@end
dirk@139
    17
dirk@139
    18
@implementation PepTests
dirk@139
    19
dirk@139
    20
- (void)setUp {
dirk@139
    21
    [super setUp];
dirk@184
    22
    [PEPObjCAdapter setupTrustWordsDB:[NSBundle bundleForClass:[self class]]];
dirk@139
    23
}
dirk@139
    24
dirk@738
    25
- (void)tearDown
dirk@738
    26
{
dirk@738
    27
    [PEPSession cleanup];
dirk@738
    28
}
dirk@738
    29
dirk@139
    30
- (void)testSessionFinalization {
dirk@139
    31
    PEPSession *session = [[PEPSession alloc] init];
dirk@139
    32
    session = nil;
dirk@139
    33
}
dirk@139
    34
dirk@173
    35
- (void)testLanguageList {
dirk@173
    36
    PEPSession *session = [[PEPSession alloc] init];
dirk@560
    37
    NSError *error = nil;
dirk@560
    38
    NSArray<PEPLanguage *> *langs = [session languageListWithError:&error];
dirk@560
    39
    XCTAssertNil(error);
dirk@173
    40
    XCTAssertGreaterThan(langs.count, 0);
dirk@173
    41
    BOOL foundEn = NO;
dirk@173
    42
    for (PEPLanguage *lang in langs) {
dirk@173
    43
        if ([lang.code isEqualToString:@"en"]) {
dirk@173
    44
            foundEn = YES;
dirk@173
    45
        }
dirk@173
    46
    }
dirk@173
    47
    XCTAssertTrue(foundEn);
dirk@173
    48
}
dirk@173
    49
dirk@139
    50
@end