コード例 #1
0
        public void CreateContinueCommand() {
            // Arrange
            const int commandId = 3;
            const SteppingKind stepping = SteppingKind.Out;

            // Act
            var continueCommand = new ContinueCommand(commandId, stepping);

            // Assert
            Assert.AreEqual(commandId, continueCommand.Id);
            Assert.AreEqual(
                string.Format(
                    "{{\"command\":\"continue\",\"seq\":{0},\"type\":\"request\",\"arguments\":{{\"stepaction\":\"{1}\",\"stepcount\":1}}}}",
                    commandId, stepping.ToString().ToLower()),
                continueCommand.ToString());
        }
コード例 #2
0
        public void CreateContinueCommandWithOptionalParameters() {
            // Arrange
            const int commandId = 3;
            const SteppingKind stepping = SteppingKind.Out;
            const int stepCount = 3;

            // Act
            var continueCommand = new ContinueCommand(commandId, stepping, stepCount);

            // Assert
            Assert.AreEqual(commandId, continueCommand.Id);
            Assert.AreEqual(
                string.Format(
                    "{{\"command\":\"continue\",\"seq\":{0},\"type\":\"request\",\"arguments\":{{\"stepaction\":\"{1}\",\"stepcount\":{2}}}}}",
                    commandId, stepping.ToString().ToLower(CultureInfo.InvariantCulture), stepCount),
                continueCommand.ToString());
        }
コード例 #3
0
        /// <summary>
        /// Updates a module content while debugging.
        /// </summary>
        /// <param name="module">Node module.</param>
        /// <returns>Operation result.</returns>
        internal async Task<bool> UpdateModuleSourceAsync(NodeModule module) {
            module.Source = File.ReadAllText(module.JavaScriptFileName);

            var changeLiveCommand = new ChangeLiveCommand(CommandId, module);

            // Check whether update was successfull
            if (!await TrySendRequestAsync(changeLiveCommand).ConfigureAwait(false) ||
                !changeLiveCommand.Updated) {
                return false;
            }

            // Make step into and update stacktrace if required
            if (changeLiveCommand.StackModified) {
                var continueCommand = new ContinueCommand(CommandId, SteppingKind.Into);
                await TrySendRequestAsync(continueCommand).ConfigureAwait(false);
                await CompleteSteppingAsync(false).ConfigureAwait(false);
            }

            return true;
        }
コード例 #4
0
        private async Task ContinueAsync(SteppingKind stepping = SteppingKind.None, int stepCount = 1, CancellationToken cancellationToken = new CancellationToken()) {
            // Ensure load complete and entrypoint breakpoint/tracepoint handling disabled after first real continue
            _loadCompleteHandled = true;
            _handleEntryPointHit = false;

            var continueCommand = new ContinueCommand(CommandId, stepping, stepCount);
            await TrySendRequestAsync(continueCommand, cancellationToken).ConfigureAwait(false);
        }