mercredi 24 août 2016

Creating dummy object with values with OCMOCK

It was my first time i was trying to use OCMOCK framework for testing my iOS application and i have some confusion about it.

Lets say i have a class name called School and i want to test it. This class contains students. Lets say i want to start the school by adding a student, so i do some thing like this School *school = [School alloc] initWithOneStudent:student];

Now Student Class is like this.

@interface Student : NSObject 
@property (nonatomic, strong) NSString *firstName;
@property (nonatomic, strong) NSString *lastName;

@end

Now how i can get a student object in my test case which has some values for firstName and lastName when i mock it to pass it to initWithOneStudent

I just made up this example, so please excuse if you don't like this example.

Aucun commentaire:

Enregistrer un commentaire