public static void SetGameOverEventArgs(GameOverEventArgs e) { ScenarioContext.Current[GAME_OVER_EVENTARGS_KEY] = e; }
private void RaiseGameOver(GameResult result) { var handler = this.GameOver; if (handler != null) { var eventArgs = new GameOverEventArgs(result); handler(this, eventArgs); } }
// If we were testing against a real GUI instead of just a domain model, // the GUI might handle events/exceptions and update a UI element such as // a status bar to display a message. We mimic that here by storing a message // in the ScenarioContext. private void SetGameOverMessage(GameOverEventArgs e) { switch (e.Result) { case GameResult.BlackWin: ScenarioContextUtils.SetChessBoardMessage(BLACK_KNIGHT_WINS_MESSAGE); break; case GameResult.WhiteWin: ScenarioContextUtils.SetChessBoardMessage(WHITE_PAWN_WINS_MESSAGE); break; case GameResult.Draw: ScenarioContextUtils.SetChessBoardMessage(COLLISION_DRAW_MESSAGE); break; } }