NSString+YHAnalyticsTests.m 1.21 KB
//
//  NSString+YHAnalyticsTests.m
//  YH_Analytics
//
//  Created by Zhou Rongjun on 15/4/15.
//  Copyright (c) 2015年 YOHO. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
#import "NSString+YHAnalytics.h"

@interface NSString_YHAnalyticsTests : XCTestCase {
@private
    id mock;
}

@end

@implementation NSString_YHAnalyticsTests

- (void)setUp {
    [super setUp];
    // Put setup code here. This method is called before the invocation of each test method in the class.
    NSLog(@"%@ setUp", self.name);
    mock = [OCMockObject mockForClass:[NSString class]];
    XCTAssertNotNil(mock, @"Cannot create NSString mock");
}

- (void)tearDown {
    // Put teardown code here. This method is called after the invocation of each test method in the class.
    mock = nil;
    [super tearDown];
    NSLog(@"%@ tearDown", self.name);
}

- (void)testMd5Method {
    NSLog(@"%@ start", self.name);
    
    [[mock expect] md5];
    [mock md5];
    [mock verify];
    
    NSLog(@"%@ end", self.name);
}

- (void)testUrlDecodedStringMethod {
    NSLog(@"%@ start", self.name);
    
    [[mock expect] urlDecodedString];
    [mock urlDecodedString];
    [mock verify];
    
    NSLog(@"%@ end", self.name);
}

@end