Exemplo n.º 1
0
        public StartingANewGame()
        {
            var output = new TestOutput();
            _app = new ChessApp(output);

            _app.Handle(new CreateGameAppCommand());
            _latestGameName = output.LatestGameName;
            _newGame = _app.GetGame(_latestGameName);
        }
        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));
        }
Exemplo n.º 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);
                }
            }
        }
Exemplo n.º 4
0
 public void NewSessionsAreRunning()
 {
     var app = new ChessApp(new TestOutput());
     Assert.True(app.IsRunning);
 }
Exemplo n.º 5
0
 public StoppingChessApp()
 {
     _output = new TestOutput();
     _app = new ChessApp(_output);
 }
Exemplo n.º 6
0
 public void Run(ChessApp app)
 {
 }
Exemplo n.º 7
0
 public InputtingCommands()
 {
     var output = new TestOutput();
     _app = new ChessApp(output);
 }