Ejemplo n.º 1
0
        /// <summary>
        /// Handles evaluate response message.
        /// </summary>
        /// <param name="stackFrame">Stack frame.</param>
        /// <param name="expression">Expression.</param>
        /// <param name="message">Message.</param>
        /// <returns>Evaluation result.</returns>
        public NodeEvaluationResult ProcessEvaluate(NodeStackFrame stackFrame, string expression, JsonValue message)
        {
            Utilities.ArgumentNotNull("stackFrame", stackFrame);
            Utilities.ArgumentNotNull("expression", expression);
            Utilities.ArgumentNotNull("message", message);

            JsonValue body             = message["body"];
            var       variableProvider = new NodeEvaluationVariable(stackFrame, expression, body);

            return(_evaluationResultFactory.Create(variableProvider));
        }
Ejemplo n.º 2
0
        public void CreateBacktraceVariableWithNullName() {
            // Arrange
            JObject json = SerializationTestData.GetBacktraceJsonObject();
            Exception exception = null;
            NodeEvaluationVariable result = null;
            const string name = "name";

            // Act
            try {
                result = new NodeEvaluationVariable(null, name, json);
            } catch (Exception e) {
                exception = e;
            }

            // Assert
            Assert.IsNull(result);
            Assert.IsNotNull(exception);
            Assert.IsInstanceOfType(exception, typeof (ArgumentNullException));
        }
Ejemplo n.º 3
0
        public void CreateEvaluationVariable() {
            // Arrange
            JObject json = SerializationTestData.GetEvaluationJsonObject();
            var stackFrame = new NodeStackFrame(0);
            const string name = "name";

            // Act
            var result = new NodeEvaluationVariable(stackFrame, name, json);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(NodePropertyAttributes.None, result.Attributes);
            Assert.IsNull(result.Class);
            Assert.AreEqual(16, result.Id);
            Assert.AreEqual(name, result.Name);
            Assert.IsNull(result.Parent);
            Assert.AreEqual(stackFrame, result.StackFrame);
            Assert.AreEqual("<tag>Value</tag>", result.Text);
            Assert.AreEqual(NodePropertyType.Normal, result.Type);
            Assert.AreEqual("string", result.TypeName);
            Assert.AreEqual("<tag>Value</tag>", result.Value);
        }
Ejemplo n.º 4
0
        public override void ProcessResponse(JObject response) {
            base.ProcessResponse(response);

            var variableProvider = new NodeEvaluationVariable(_stackFrame, _expression, response["body"]);
            Result = _resultFactory.Create(variableProvider);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Handles evaluate response message.
        /// </summary>
        /// <param name="stackFrame">Stack frame.</param>
        /// <param name="expression">Expression.</param>
        /// <param name="message">Message.</param>
        /// <returns>Evaluation result.</returns>
        public NodeEvaluationResult ProcessEvaluate(NodeStackFrame stackFrame, string expression, JsonValue message) {
            Utilities.ArgumentNotNull("stackFrame", stackFrame);
            Utilities.ArgumentNotNull("expression", expression);
            Utilities.ArgumentNotNull("message", message);

            JsonValue body = message["body"];
            var variableProvider = new NodeEvaluationVariable(stackFrame, expression, body);
            return _evaluationResultFactory.Create(variableProvider);
        }
Ejemplo n.º 6
0
        public void CreateBacktraceVariableWithNullJson() {
            // Arrange
            var stackFrame = new NodeStackFrame(0);
            Exception exception = null;
            NodeEvaluationVariable result = null;
            const string name = "name";

            // Act
            try {
                result = new NodeEvaluationVariable(stackFrame, name, null);
            } catch (Exception e) {
                exception = e;
            }

            // Assert
            Assert.IsNull(result);
            Assert.IsNotNull(exception);
            Assert.IsInstanceOfType(exception, typeof (ArgumentNullException));
        }