/// <summary> /// Initializes a new instance of the <see cref="CommandParser"/> class. /// </summary> /// <param name="game">The <see cref="MinesweeperGame"/> object for which commands will be returned.</param> public CommandParser(MinesweeperGame game) { if (game == null) { throw new ArgumentNullException(); } this.Game = game; // Create commands ICommand cmdRestart = new CmdRestart(game); ICommand cmdBoom = new CmdBoom(game); ICommand cmdShowScores = new CmdShowScores(game); ICommand cmdEndGame = new CmdExit(game); ICommand cmdInvalid = new CmdInvalid(game); this.commands = new Dictionary<string, ICommand>() { { "restart", cmdRestart }, { "top", cmdShowScores }, { "exit", cmdEndGame }, { "boom", cmdBoom }, { "invalid", cmdInvalid } }; }
/// <summary> /// Initializes a new instance of the <see cref="CommandParser"/> class. /// </summary> /// <param name="game">The <see cref="MinesweeperGame"/> object for which commands will be returned.</param> public CommandParser(MinesweeperGame game) { if (game == null) { throw new ArgumentNullException(); } this.Game = game; // Create commands ICommand cmdRestart = new CmdRestart(game); ICommand cmdBoom = new CmdBoom(game); ICommand cmdShowScores = new CmdShowScores(game); ICommand cmdEndGame = new CmdExit(game); ICommand cmdInvalid = new CmdInvalid(game); this.commands = new Dictionary <string, ICommand>() { { "restart", cmdRestart }, { "top", cmdShowScores }, { "exit", cmdEndGame }, { "boom", cmdBoom }, { "invalid", cmdInvalid } }; }
public void Test_CmdBoom_CtorWithNullThrowsEx() { var cmd = new CmdBoom(null); }