コード例 #1
0
        public JoiningAGameFullOfPlayers()
        {
            _output = new TestOutput();
            var app = new ChessApp(_output);

            app.Handle(new CreateGameAppCommand());
            var latestGameName = _output.LatestGameName;
            var newGame = app.GetGame(latestGameName);

            app.Handle(new JoinGameAppCommand(latestGameName, "denise", PlayerColour.Black));
            app.Handle(new JoinGameAppCommand(latestGameName, "derek", PlayerColour.White));

            _existingBlackPlayer = newGame.GetPlayer(PlayerColour.Black);
            _existingWhitePlayer = newGame.GetPlayer(PlayerColour.White);

            app.Handle(new JoinGameAppCommand(latestGameName, "gary", PlayerColour.Black));
        }
コード例 #2
0
        public StartingANewGame()
        {
            var output = new TestOutput();
            _app = new ChessApp(output);

            _app.Handle(new CreateGameAppCommand());
            _latestGameName = output.LatestGameName;
            _newGame = _app.GetGame(_latestGameName);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: joeywinsford/Chess
        public static void Main(string[] args)
        {
            var app = new ChessApp(new CommandLineOutput());
            var interpreter = new StringCommandInterpreter();

            while (app.IsRunning)
            {
                var input = Console.ReadLine();
                var command = interpreter.GetCommand(input);
                if (command != null)
                {
                    app.Handle(command);
                }
                else
                {
                    Console.WriteLine("Unknown command '{0}'.", input);
                }
            }
        }