【发布时间】:2011-08-07 20:47:51
【问题描述】:
产品构建成功,但测试失败。如何通过下面STAssertEquals 行报告的类型不匹配失败?
// TransactionSpec.m
#import "Transaction.h"
@interface TransactionSpec : SenTestCase
@end
@implementation TransactionSpec
#pragma mark Properties
- (void)testProperties {
Transaction *transaction = [[Transaction alloc] init];
transaction.type = TransactionTypePay;
STAssertNotNil(transaction, @"transaction exists");
STAssertEquals(transaction.type, TransactionTypePay, @"type property works"); // Type mismatch
}
@end
// Transaction.h
typedef enum {
TransactionTypePay,
TransactionTypeCharge
} TransactionType;
@interface Transaction : NSObject
@property (nonatomic) TransactionType *type;
@end
// Transaction.m
#import "Transaction.h"
@implementation Transaction
@synthesize type;
@end
【问题讨论】:
标签: objective-c xcode enums typedef type-mismatch