/
GBCommentTesting.m
60 lines (50 loc) · 1.68 KB
/
GBCommentTesting.m
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
53
54
55
56
57
58
59
60
//
// GBCommentTesting.m
// appledoc
//
// Created by Tomaz Kragelj on 25.7.10.
// Copyright (C) 2010 Gentle Bytes. All rights reserved.
//
#import "GBApplicationSettingsProvider.h"
#import "GBDataObjects.h"
@interface GBCommentTesting : GHTestCase
@end
@implementation GBCommentTesting
#pragma mark Initialization & disposal
- (void)testInit_shouldSetupDefaultComponents {
// setup & execute
GBComment *comment = [GBComment commentWithStringValue:@""];
// verify
assertThat(comment.longDescription, isNot(nil));
assertThat(comment.relatedItems, isNot(nil));
assertThat(comment.methodParameters, isNot(nil));
assertThat(comment.methodExceptions, isNot(nil));
assertThat(comment.methodResult, isNot(nil));
assertThat(comment.availability, isNot(nil));
}
#pragma mark Comment components testing
- (void)testHtmlString_shouldUseAssignedSettings {
// setup
GBCommentComponent *component = [GBCommentComponent componentWithStringValue:@"source"];
component.markdownValue = @"markdown";
OCMockObject *settings = [GBTestObjectsRegistry mockSettingsProvider];
component.settings = settings;
[[settings expect] stringByConvertingMarkdownToHTML:component.markdownValue];
// execute
(void)component.htmlValue;
// verify
[settings verify];
}
- (void)testTextString_shouldUseAssignedSettings {
// setup
GBCommentComponent *component = [GBCommentComponent componentWithStringValue:@"source"];
component.markdownValue = @"markdown";
OCMockObject *settings = [GBTestObjectsRegistry mockSettingsProvider];
component.settings = settings;
[[settings expect] stringByConvertingMarkdownToText:component.markdownValue];
// execute
(void)component.textValue;
// verify
[settings verify];
}
@end