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
        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);
                }
            }
        }