Execute() public method

public Execute ( Game game, IMessageLog log ) : void
game Game
log IMessageLog
return void
コード例 #1
0
        public void PlayerStartingPositionsAreLogged()
        {
            var player1 = new Player("Player 1");
            var player2 = new Player("Player 2");
            var game = Game.CreateNewGame(10, 10, player1, player2);
            var log = new JsonMessageLog();

            var command = new StartGameCommand();
            command.Execute(game, log);

            log.AssertMessageTypes(GameMessageType.NewGame, GameMessageType.PlayerAdded, GameMessageType.PlayerAdded);
        }
コード例 #2
0
        public void TwoPlayersStartInOppositeCorners()
        {
            var player1 = new Player("Player 1");
            var player2 = new Player("Player 2");
            var game = Game.CreateNewGame(10, 10, player1, player2);
            var log = new JsonMessageLog();

            var command = new StartGameCommand();
            command.Execute(game, log);

            var pos1 = player1.Position;
            var pos2 = player2.Position;

            Assert.AreEqual(0, pos1.X);
            Assert.AreEqual(0, pos1.Y);

            Assert.AreEqual(9, pos2.X);
            Assert.AreEqual(9, pos2.Y);
        }