@@ -45,10 +45,10 @@ public void TestJsonParser()
45
45
}
46
46
47
47
const int MinFruits = 40 ;
48
- const int MaxFruits = 145 ;
48
+ const int MaxFruits = 545 ;
49
49
const int MaxAttempts = 100 ;
50
50
const int MaxMilliseconds = 200000 ;
51
- const int SecretValue = 91 ;
51
+ const int SecretValue = 191 ;
52
52
53
53
public IGameResolver GetGameResolver ( )
54
54
{
@@ -130,32 +130,38 @@ public void TestGameRuler_TaskDelay()
130
130
131
131
try
132
132
{
133
- using ( var gr = new GuessGameInlineDelayHost (
133
+ using ( var gr = GameHostFactory . GetGameAIHost ( "InlineDelay" ,
134
134
GetGameRules ( ) ,
135
135
GetGameResolver ( ) ,
136
136
PlayerFactoryParserJson . NewJsonPlayer ( InputJson ) ,
137
137
log . Object ) )
138
138
{
139
139
gr . StartGame ( ) ;
140
140
141
- Debug . WriteLine ( "Is cancellation requested: {0}" , gr . IsCancellationRequested ) ;
141
+ Log ( "Is cancellation requested: {0}" , gr . IsCancellationRequested ) ;
142
142
143
143
Assert . IsTrue ( gr . GameLog . GuessHistory . Count <= MaxAttempts ) ;
144
144
Assert . IsTrue ( gr . GameLog . GuessHistory . Count > 0 ) ;
145
145
146
+ var go = gr . GameOutput ;
147
+ Log ( "Winner player {0}" , go . WinnerPlayer . Name ) ;
148
+ Log ( "Number of attempts {0}" , go . NumberOfAttempts ) ;
149
+ Log ( "Secret value {0}" , go . SecretValue ) ;
150
+
146
151
foreach ( var p in gr . GameLog . GuessHistory )
147
- Debug . WriteLine ( "Output : {0}, guess {1}", p . Key . Name , p . Value ) ;
152
+ Log ( "Game log : {0}, guess {1}", p . Key . Name , p . Value ) ;
148
153
}
149
154
}
150
155
catch ( Exception e )
151
156
{
152
- Debug . WriteLine ( e . Message , e . StackTrace ) ;
157
+ Log ( e . Message , e . StackTrace ) ;
153
158
var ex = e . InnerException ;
154
159
while ( ex != null )
155
160
{
156
- Debug . WriteLine ( ex . Message , ex . StackTrace ) ;
161
+ Log ( ex . Message , ex . StackTrace ) ;
157
162
ex = ex . InnerException ;
158
163
}
164
+ Assert . Fail ( ) ;
159
165
}
160
166
}
161
167
[ TestMethod ]
@@ -167,32 +173,38 @@ public void TestGameRuler_AwaitEvent()
167
173
168
174
try
169
175
{
170
- using ( var gr = new GuessGameAwaitableFailHost (
176
+ using ( var gr = GameHostFactory . GetGameAIHost ( "awaitable" ,
171
177
GetGameRules ( ) ,
172
178
GetGameResolver ( ) ,
173
179
PlayerFactoryParserJson . NewJsonPlayer ( InputJson ) ,
174
180
log . Object ) )
175
181
{
176
182
gr . StartGame ( ) ;
177
183
178
- Debug . WriteLine ( "Is cancellation requested: {0}" , gr . IsCancellationRequested ) ;
184
+ Log ( "Is cancellation requested: {0}" , gr . IsCancellationRequested ) ;
179
185
180
186
Assert . IsTrue ( gr . GameLog . GuessHistory . Count <= MaxAttempts ) ;
181
187
Assert . IsTrue ( gr . GameLog . GuessHistory . Count > 0 ) ;
182
188
189
+ var go = gr . GameOutput ;
190
+ Log ( "Winner player {0}" , go . WinnerPlayer . Name ) ;
191
+ Log ( "Number of attempts {0}" , go . NumberOfAttempts ) ;
192
+ Log ( "Secret value {0}" , go . SecretValue ) ;
193
+
183
194
foreach ( var p in gr . GameLog . GuessHistory )
184
- Debug . WriteLine ( "Output : {0}, guess {1}", p . Key . Name , p . Value ) ;
195
+ Log ( "Game log : {0}, guess {1}", p . Key . Name , p . Value ) ;
185
196
}
186
197
}
187
198
catch ( Exception e )
188
199
{
189
- Debug . WriteLine ( e . Message , e . StackTrace ) ;
200
+ Log ( e . Message , e . StackTrace ) ;
190
201
var ex = e . InnerException ;
191
202
while ( ex != null )
192
203
{
193
- Debug . WriteLine ( ex . Message , ex . StackTrace ) ;
204
+ Log ( ex . Message , ex . StackTrace ) ;
194
205
ex = ex . InnerException ;
195
206
}
207
+ Assert . Fail ( ) ;
196
208
}
197
209
198
210
}
0 commit comments