Commit 92a32db2 authored by 翟国钧's avatar 翟国钧

添加用户的城市信息。更改对应的单元测试

parent 89abe3e5
......@@ -16,6 +16,7 @@ NSString *const MockAppName = @"gengmei_test";
NSString *const MockChannelId = @"AppStore";
NSString *const MockEventId = @"eventId";
NSInteger const MockUserId = 1;
NSString *const MockCityId = @"beijing";
@interface GMPhotoTest : XCTestCase
@property Phobos *client;
......@@ -45,6 +46,7 @@ NSInteger const MockUserId = 1;
*/
- (void)testClientWithUserId{
[_client setUserId:MockUserId];
[_client setCurrentCityId:MockCityId];
[_client track:MockEventId];
NSArray *array = [_cache fetchObjectAtDiskWithkey:PhobosCacheKey];
XCTAssertTrue(array.count == 1, @"array is empty");
......@@ -54,12 +56,12 @@ NSInteger const MockUserId = 1;
}
/**
* @brief 测试发送不带参数事件成功
* @brief 测试发送不带参数事件成功 (由之前的实例方法变成类方法)
*
* @since <#version number#>
*/
- (void)testTrackEventWithoutAttr{
[_client track:MockEventId];
[Phobos track:MockEventId];
NSArray *array = [_cache fetchObjectAtDiskWithkey:PhobosCacheKey];
XCTAssertTrue(array.count == 1, @"array is empty");
NSDictionary *dict = [array objectAtIndex:0];
......@@ -74,7 +76,7 @@ NSInteger const MockUserId = 1;
*/
- (void)testTrackEventWithAttr{
NSDictionary *attr = @{@"attr":@"track_attr"};
[_client track:MockEventId attributes:attr];
[Phobos track:MockEventId attributes:attr];
NSArray *array = [_cache fetchObjectAtDiskWithkey:PhobosCacheKey];
XCTAssertTrue(array.count == 1, @"array is empty");
NSDictionary *dict = [array objectAtIndex:0];
......@@ -94,7 +96,7 @@ NSInteger const MockUserId = 1;
// Given
NSDictionary *attr = @{@"attr":@"track_attr"};
// When
[_client track:MockEventId attributes:attr sendNow:YES];
[Phobos track:MockEventId attributes:attr sendNow:YES];
// Then
NSArray *array = [_cache fetchObjectAtDiskWithkey:PhobosCacheKey];
XCTAssertTrue(array.count == 0, @"array should be empty");
......
......@@ -45,6 +45,17 @@
*/
- (void)setUserId:(NSInteger)userId;
/*!
* @author zhaiguojun, 16-05-30
*
* @brief 用户当前的城市id
*
* @param currentCityId
*
* @since 0.2.5
*/
- (void)setCurrentCityId:(NSString *)currentCityId;
/**
* @brief 自定义事件,数量统计.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment