main
 1//
 2// Licensed under the terms in License.txt
 3//
 4// Copyright 2010 Allen Ding. All rights reserved.
 5//
 6
 7#import "KiwiConfiguration.h"
 8#import "KWExampleNode.h"
 9
10@class KWAfterAllNode;
11@class KWAfterEachNode;
12@class KWBeforeAllNode;
13@class KWBeforeEachNode;
14@class KWCallSite;
15@class KWItNode;
16@class KWPendingNode;
17@class KWRegisterMatchersNode;
18@class KWExample;
19
20@interface KWContextNode : NSObject<KWExampleNode> {
21@private
22    KWContextNode *parentContext;
23    KWCallSite *callSite;
24    NSString *description;
25    KWRegisterMatchersNode *registerMatchersNode;
26    KWBeforeAllNode *beforeAllNode;
27    KWAfterAllNode *afterAllNode;
28    KWBeforeEachNode *beforeEachNode;
29    KWAfterEachNode *afterEachNode;
30    NSMutableArray *nodes;
31    BOOL performedExampleCount;
32}
33
34#pragma mark -
35#pragma mark Initializing
36
37- (id)initWithCallSite:(KWCallSite *)aCallSite parentContext:(KWContextNode *)node description:(NSString *)aDescription;
38
39+ (id)contextNodeWithCallSite:(KWCallSite *)aCallSite parentContext:(KWContextNode *)contextNode description:(NSString *)aDescription;
40
41#pragma mark -
42#pragma mark  Getting Call Sites
43
44@property (nonatomic, readonly) KWCallSite *callSite;
45
46#pragma mark -
47#pragma mark Getting Descriptions
48
49@property (nonatomic, readonly) NSString *description;
50
51#pragma mark -
52#pragma mark Managing Nodes
53
54@property (nonatomic, readwrite, retain) KWRegisterMatchersNode *registerMatchersNode;
55@property (nonatomic, readwrite, retain) KWBeforeAllNode *beforeAllNode;
56@property (nonatomic, readwrite, retain) KWAfterAllNode *afterAllNode;
57@property (nonatomic, readwrite, retain) KWBeforeEachNode *beforeEachNode;
58@property (nonatomic, readwrite, retain) KWAfterEachNode *afterEachNode;
59@property (nonatomic, readonly) KWContextNode *parentContext;
60@property (nonatomic, readonly) NSArray *nodes;
61
62- (void)addContextNode:(KWContextNode *)aNode;
63- (void)addItNode:(KWItNode *)aNode;
64- (void)addPendingNode:(KWPendingNode *)aNode;
65
66- (void)performExample:(KWExample *)example withBlock:(void (^)(void))exampleBlock;
67
68#pragma mark -
69#pragma mark Accepting Visitors
70
71- (void)acceptExampleNodeVisitor:(id<KWExampleNodeVisitor>)aVisitor;
72
73@end