Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 52 lines (43 sloc) 1.714 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
//
// GBCommentComponentsListTesting.m
// appledoc
//
// Created by Tomaz Kragelj on 14.2.11.
// Copyright (C) 2011 Gentle Bytes. All rights reserved.
//

#import "GBDataObjects.h"

@interface GBCommentComponentsListTesting : GHTestCase
@end

@implementation GBCommentComponentsListTesting

#pragma mark Initialization & disposal

- (void)testInit_shouldInitializeEmptyList {
// setup & execute
GBCommentComponentsList *list = [[GBCommentComponentsList alloc] init];
// verify
assertThat(list.components, isNot(nil));
assertThatInteger([list.components count], equalToInteger(0));
}

#pragma mark Registration testing

- (void)testRegisterComponent_shouldAddComponentToComponentsArray {
// setup
GBCommentComponentsList *list = [[GBCommentComponentsList alloc] init];
// execute
[list registerComponent:[GBCommentComponent componentWithStringValue:@"a"]];
// verify
assertThatInteger([list.components count], equalToInteger(1));
assertThat([[list.components objectAtIndex:0] stringValue], is(@"a"));
}

- (void)testRegisterComponent_shouldAddComponentsToArrayInOrder {
// setup
GBCommentComponentsList *list = [[GBCommentComponentsList alloc] init];
// execute
[list registerComponent:[GBCommentComponent componentWithStringValue:@"a"]];
[list registerComponent:[GBCommentComponent componentWithStringValue:@"b"]];
[list registerComponent:[GBCommentComponent componentWithStringValue:@"c"]];
// verify
assertThatInteger([list.components count], equalToInteger(3));
assertThat([[list.components objectAtIndex:0] stringValue], is(@"a"));
assertThat([[list.components objectAtIndex:1] stringValue], is(@"b"));
assertThat([[list.components objectAtIndex:2] stringValue], is(@"c"));
}

@end
Something went wrong with that request. Please try again.