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 CreateDebuggerClientWithNullConnection() {
            // Arrange
            Exception exception = null;
            DebuggerClient client = null;

            // Act
            try {
                client = new DebuggerClient(null);
            } catch (Exception e) {
                exception = e;
            }

            // Assert
            Assert.IsNull(client);
            Assert.IsNotNull(exception);
            Assert.IsInstanceOfType(exception, typeof (ArgumentNullException));
        }
        public void RaiseCompileScriptEventViaDebuggerClient() {
            // Arrange
            var connectionMock = new Mock<IDebuggerConnection>();
            var messageEventArgs = new MessageEventArgs(Resources.NodeCompileScriptResponse);
            var client = new DebuggerClient(connectionMock.Object);
            object sender = null;
            CompileScriptEventArgs args = null;

            // Act
            client.CompileScriptEvent += (s, a) => {
                sender = s;
                args = a;
            };
            connectionMock.Raise(f => f.OutputMessage += null, messageEventArgs);

            // Assert
            Assert.AreEqual(client, sender);
            Assert.IsNotNull(args);
            Assert.IsNotNull(args.CompileScriptEvent);
        }