Skip to content

Instantly share code, notes, and snippets.

@yas375
Created January 26, 2012 12:30
Show Gist options
  • Select an option

  • Save yas375/1682563 to your computer and use it in GitHub Desktop.

Select an option

Save yas375/1682563 to your computer and use it in GitHub Desktop.
A little unit test example
#import <SenTestingKit/SenTestingKit.h>
@class VTBForm;
@interface VTBFormTests : SenTestCase
@property (nonatomic, retain) VTBForm *screenForm;
@end
#import "VTBFormTests.h"
#import "VTBForm.h"
#import "API.h"
@implementation VTBFormTests
@synthesize screenForm = _screenForm;
- (void)setUp {
[super setUp];
self.screenForm = [[API storageAPI] formForScreenWithID:@"Test screen"];
}
- (void)tearDown {
self.screenForm = nil;
[super tearDown];
}
- (void)testSubformCreation {
VTBForm *subform = [[API storageAPI] subformForForm:self.screenForm withFormType:VTBFormTypeAnalysts];
STAssertTrue([self.screenForm.forms containsObject:subform], @"subform creation failed");
}
#pragma mark - Relation names
- (void)testRelationNameForAnalystsForm {
VTBForm *subform = [[API storageAPI] subformForForm:self.screenForm withFormType:VTBFormTypeEvents];
STAssertEqualObjects([subform relationName], @"events", @"Events form has wrong relationName");
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment