コード例 #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 PlayerMovingIntoSlotWithOwnedPiecePushesPiece()
        {
            player1.JumpTo(0, 0);
            var slot1 = game.Board.SlotAt(1, 0);
            var slot2 = game.Board.SlotAt(2, 0);

            game.Board.AddNewPieceToSlot(slot1, player1);
            var piece = slot1.Piece;

            player1.Move(Direction.Right, log);

            Assert.AreEqual(slot1, player1.Position);
            Assert.AreEqual(piece, slot2.Piece);

            log.AssertMessageTypes(GameMessageType.PieceMoved, GameMessageType.PlayerMoved);
        }