@@ -15,6 +15,8 @@ public class WhenTestClassFollowsGivenWhenThenNamingConvention
15
15
16
16
private class TypeWithoutAttribute
17
17
{
18
+ public void EstablishContext ( ) { }
19
+ public void Setup ( ) { }
18
20
public void AndThenAnotherThingIsTrue ( ) { }
19
21
public void AndWhenSomethingElseHappens ( ) { }
20
22
public void And_When_another_THING_Happens ( ) { }
@@ -41,7 +43,7 @@ public void Setup()
41
43
[ Test ]
42
44
public void AllMethodsFollowingTheNamingConventionAreReturnedAsSteps ( )
43
45
{
44
- Assert . That ( _steps . Count , Is . EqualTo ( 14 ) ) ;
46
+ Assert . That ( _steps . Count , Is . EqualTo ( 16 ) ) ;
45
47
}
46
48
47
49
private static void AssertStep ( ExecutionStep step , string stepTitle , ExecutionOrder order , bool asserts = false , bool shouldReport = true )
@@ -53,87 +55,99 @@ private static void AssertStep(ExecutionStep step, string stepTitle, ExecutionOr
53
55
}
54
56
55
57
[ Test ]
56
- public void GivenIsReturnedFirst ( )
58
+ public void EndsWithContext_IsReturnedFirst ( )
57
59
{
58
- AssertStep ( _steps [ 0 ] , "Given some state" , ExecutionOrder . SetupState ) ;
60
+ AssertStep ( _steps [ 0 ] , "Establish context" , ExecutionOrder . Initialize , false , false ) ;
61
+ }
62
+
63
+ [ Test ]
64
+ public void Setup_IsReturnedSecond ( )
65
+ {
66
+ AssertStep ( _steps [ 1 ] , "Setup" , ExecutionOrder . Initialize , false , false ) ;
67
+ }
68
+
69
+ [ Test ]
70
+ public void Given_IsTurnedIntoA_Given_Step ( )
71
+ {
72
+ AssertStep ( _steps [ 2 ] , "Given some state" , ExecutionOrder . SetupState ) ;
59
73
}
60
74
61
75
[ Test ]
62
76
public void AndGiven_IsTurnedIntoAn_AndGiven_Step ( )
63
77
{
64
- AssertStep ( _steps [ 1 ] , "And another state" , ExecutionOrder . ConsecutiveSetupState ) ;
78
+ AssertStep ( _steps [ 3 ] , "And another state" , ExecutionOrder . ConsecutiveSetupState ) ;
65
79
}
66
80
67
81
[ Test ]
68
82
public void And_Given_IsTurnedIntoAn_AndGiven_Step ( )
69
83
{
70
- AssertStep ( _steps [ 2 ] , "And Some OTHER state" , ExecutionOrder . ConsecutiveSetupState ) ;
84
+ AssertStep ( _steps [ 4 ] , "And Some OTHER state" , ExecutionOrder . ConsecutiveSetupState ) ;
71
85
}
72
86
73
87
[ Test ]
74
88
public void AndGiven_InAnUnderscoredMethod_IsTurnedIntoAn_AndGiven_Step ( )
75
89
{
76
- AssertStep ( _steps [ 3 ] , "And some other initial state" , ExecutionOrder . ConsecutiveSetupState ) ;
90
+ AssertStep ( _steps [ 5 ] , "And some other initial state" , ExecutionOrder . ConsecutiveSetupState ) ;
77
91
}
78
92
79
93
[ Test ]
80
94
public void WhenIsReturnedAfterGivens ( )
81
95
{
82
- AssertStep ( _steps [ 4 ] , "When something happens" , ExecutionOrder . Transition ) ;
96
+ AssertStep ( _steps [ 6 ] , "When something happens" , ExecutionOrder . Transition ) ;
83
97
}
84
98
85
99
[ Test ]
86
100
public void AndWhenIsTurnedIntoAn_AndWhen_Step ( )
87
101
{
88
- AssertStep ( _steps [ 5 ] , "And something else happens" , ExecutionOrder . ConsecutiveTransition ) ;
102
+ AssertStep ( _steps [ 7 ] , "And something else happens" , ExecutionOrder . ConsecutiveTransition ) ;
89
103
}
90
104
91
105
[ Test ]
92
106
public void And_When_IsTurnedIntoAn_AndWhen_Step ( )
93
107
{
94
- AssertStep ( _steps [ 6 ] , "And another THING Happens" , ExecutionOrder . ConsecutiveTransition ) ;
108
+ AssertStep ( _steps [ 8 ] , "And another THING Happens" , ExecutionOrder . ConsecutiveTransition ) ;
95
109
}
96
110
97
111
[ Test ]
98
112
public void ThenIsReturnedAfterWhens ( )
99
113
{
100
- AssertStep ( _steps [ 7 ] , "Then something is true" , ExecutionOrder . Assertion , true ) ;
114
+ AssertStep ( _steps [ 9 ] , "Then something is true" , ExecutionOrder . Assertion , true ) ;
101
115
}
102
116
103
117
[ Test ]
104
118
public void AndThen_IsReturnedAsAn_AndThen_StepAfterThen ( )
105
119
{
106
- AssertStep ( _steps [ 8 ] , "And another thing is true" , ExecutionOrder . ConsecutiveAssertion , true ) ;
120
+ AssertStep ( _steps [ 10 ] , "And another thing is true" , ExecutionOrder . ConsecutiveAssertion , true ) ;
107
121
}
108
122
109
123
[ Test ]
110
124
public void And_IsReturnedAsAn_AndThen_Step ( )
111
125
{
112
- AssertStep ( _steps [ 9 ] , "And something else too" , ExecutionOrder . ConsecutiveAssertion , true ) ;
126
+ AssertStep ( _steps [ 11 ] , "And something else too" , ExecutionOrder . ConsecutiveAssertion , true ) ;
113
127
}
114
128
115
129
[ Test ]
116
130
public void And_IsReturnedAsAn_AndThen_WithTheRightCasing ( )
117
131
{
118
- AssertStep ( _steps [ 10 ] , "And YET another thing" , ExecutionOrder . ConsecutiveAssertion , true ) ;
132
+ AssertStep ( _steps [ 12 ] , "And YET another thing" , ExecutionOrder . ConsecutiveAssertion , true ) ;
119
133
}
120
134
121
135
[ Test ]
122
136
public void AndThen_IsReturnedAsAn_AndThen_WithUnderscoredMethodName ( )
123
137
{
124
- AssertStep ( _steps [ 11 ] , "And something else" , ExecutionOrder . ConsecutiveAssertion , true ) ;
138
+ AssertStep ( _steps [ 13 ] , "And something else" , ExecutionOrder . ConsecutiveAssertion , true ) ;
125
139
}
126
140
127
141
[ Test ]
128
142
public void And_Then_IsReturnedAsAn_AndThen_WithUnderscoredMethodName ( )
129
143
{
130
- AssertStep ( _steps [ 12 ] , "And there was that one time" , ExecutionOrder . ConsecutiveAssertion , true ) ;
144
+ AssertStep ( _steps [ 14 ] , "And there was that one time" , ExecutionOrder . ConsecutiveAssertion , true ) ;
131
145
}
132
146
133
147
[ Test ]
134
148
public void TearDownMethodIsReturnedInTheCorrectSpot ( )
135
149
{
136
- AssertStep ( _steps [ 13 ] , "Tear down" , ExecutionOrder . TearDown , asserts : false , shouldReport : false ) ;
150
+ AssertStep ( _steps [ 15 ] , "Tear down" , ExecutionOrder . TearDown , asserts : false , shouldReport : false ) ;
137
151
}
138
152
}
139
153
}
0 commit comments