예제 #1
0
        public void DeletePieceSuccess()
        {
            var msg2 = new Message <DeletePieceResponsePayload>()
            {
                Type        = Common.Consts.DeletePieceResponse,
                SenderId    = Common.Consts.GameMasterId,
                RecipientId = _assignedPlayerId
            };

            _playerState.HeldPiece = new Piece()
            {
                IsSham = false
            };;

            _messageProvider.Setup(x => x.Receive <ActionValidPayload>()).Returns(new Message <ActionValidPayload>());
            _messageProvider.Setup(x => x.Receive <DeletePieceResponsePayload>()).Returns(msg2);

            // ------------------------

            var actionExecutor = new ActionExecutor(_messageProvider.Object, _playerState);
            var result         = actionExecutor.DeletePiece();

            // ------------------------

            Assert.That(result, Is.True);
            Assert.That(_playerState.HeldPiece, Is.Null);
        }
예제 #2
0
        public void DeletePieceActionInvalid()
        {
            _messageProvider.Setup(x => x.Receive <ActionValidPayload>()).Throws(new ActionInvalidException());

            var actionExecutor = new ActionExecutor(_messageProvider.Object, _playerState);
            var result         = actionExecutor.DeletePiece();

            Assert.That(result, Is.False);
        }