public void CreateDisconnectCommand() {
            // Arrange
            const int commandId = 3;

            // Act
            var disconnectCommand = new DisconnectCommand(commandId);

            // Assert
            Assert.AreEqual(commandId, disconnectCommand.Id);
            Assert.AreEqual(
                string.Format(
                    "{{\"command\":\"disconnect\",\"seq\":{0},\"type\":\"request\",\"arguments\":null}}",
                    commandId),
                disconnectCommand.ToString());
        }
예제 #2
0
        public async Task SendMessageViaDebuggerClient() {
            // Arrange
            var connectionMock = new Mock<IDebuggerConnection>();
            var messageEventArgs = new MessageEventArgs(Resources.NodeDisconnectResponse);
            connectionMock.Setup(p => p.SendMessage(It.IsAny<string>()))
                .Raises(f => f.OutputMessage += null, messageEventArgs);
            var client = new DebuggerClient(connectionMock.Object);
            var disconnectCommand = new DisconnectCommand(10);

            // Act
            await client.SendRequestAsync(disconnectCommand);

            // Assert
            Assert.IsTrue(disconnectCommand.Running);
        }
 public void Detach() {
     DebugWriteCommand("Detach");
     DebuggerClient.RunWithRequestExceptionsHandled(async () => {
         // Disconnect request has no response
         var tokenSource = new CancellationTokenSource(_timeout);
         var disconnectCommand = new DisconnectCommand(CommandId);
         await TrySendRequestAsync(disconnectCommand, tokenSource.Token).ConfigureAwait(false);
         _connection.Close();
     });
 }