public void CreateBooleanEvaluationResult() { // Arrange var variable = new MockNodeVariable { Id = 21, Parent = null, StackFrame = null, Name = "v_boolean", TypeName = "boolean", Value = "false", Class = null, Text = null }; var factory = new EvaluationResultFactory(); // Act NodeEvaluationResult result = factory.Create(variable); // Assert Assert.IsNotNull(result); Assert.AreEqual(variable.Name, result.Expression); Assert.IsNull(result.Frame); Assert.AreEqual(variable.Name, result.FullName); Assert.AreEqual(variable.Id, result.Handle); Assert.IsNull(result.HexValue); Assert.AreEqual(variable.Value.Length, result.StringLength); Assert.AreEqual(variable.Value, result.StringValue); Assert.AreEqual(NodeExpressionType.Boolean, result.Type); Assert.AreEqual(NodeVariableType.Boolean, result.TypeName); }
public void CreateObjectElementWithInvalidIdentifierEvaluationResult() { // Arrange var variable = new MockNodeVariable { Id = 19, Parent = new NodeEvaluationResult(0, null, null, "Object", "v_object", "v_object", NodeExpressionType.Expandable, null), StackFrame = null, Name = "123name", TypeName = "number", Value = "0", Class = "Number", Text = null }; var factory = new EvaluationResultFactory(); // Act NodeEvaluationResult result = factory.Create(variable); // Assert Assert.IsNotNull(result); Assert.AreEqual(variable.Name, result.Expression); Assert.IsNull(result.Frame); Assert.AreEqual(string.Format(@"{0}[""{1}""]", variable.Parent.Expression, variable.Name), result.FullName); Assert.AreEqual(variable.Id, result.Handle); Assert.AreEqual(string.Format("0x{0:x}", int.Parse(variable.Value)), result.HexValue); Assert.AreEqual(variable.Value, result.StringValue); Assert.AreEqual(result.Type, NodeExpressionType.None); Assert.AreEqual(NodeVariableType.Number, result.TypeName); }
public void CreateNumberEvaluationResult() { // Arrange var variable = new MockNodeVariable { Id = 20, Parent = null, StackFrame = null, Name = "v_number", TypeName = "number", Value = "55", Class = null, Text = null }; var factory = new EvaluationResultFactory(); // Act NodeEvaluationResult result = factory.Create(variable); // Assert Assert.IsNotNull(result); Assert.AreEqual(variable.Name, result.Expression); Assert.IsNull(result.Frame); Assert.AreEqual(variable.Name, result.FullName); Assert.AreEqual(variable.Id, result.Handle); Assert.AreEqual(string.Format("0x{0:x}", int.Parse(variable.Value)), result.HexValue); Assert.AreEqual(variable.Value.Length, result.StringLength); Assert.AreEqual(variable.Value, result.StringValue); Assert.AreEqual(NodeExpressionType.None, result.Type); Assert.AreEqual(NodeVariableType.Number, result.TypeName); }
public void CreateUnknownEvaluationResultWithEmptyValue() { // Arrange var variable = new MockNodeVariable { Id = 26, Parent = null, StackFrame = null, Name = "v_unknown", TypeName = "unknown", Value = null, Class = null, Text = "Unknown" }; var factory = new EvaluationResultFactory(); // Act NodeEvaluationResult result = factory.Create(variable); // Assert Assert.IsNotNull(result); Assert.AreEqual(variable.Name, result.Expression); Assert.IsNull(result.Frame); Assert.AreEqual(variable.Name, result.FullName); Assert.AreEqual(variable.Id, result.Handle); Assert.IsNull(result.HexValue); Assert.AreEqual(variable.Text, result.StringValue); Assert.AreEqual(NodeExpressionType.None, result.Type); Assert.AreEqual(NodeVariableType.Unknown, result.TypeName); }
public void CreateErrorEvaluationResult() { // Arrange var variable = new MockNodeVariable { Id = 26, Parent = null, StackFrame = null, Name = "v_error", TypeName = "error", Value = "Error: dsfdsf", Class = null, Text = null }; var factory = new EvaluationResultFactory(); // Act NodeEvaluationResult result = factory.Create(variable); // Assert Assert.IsNotNull(result); Assert.AreEqual(variable.Name, result.Expression); Assert.IsNull(result.Frame); Assert.AreEqual(variable.Name, result.FullName); Assert.AreEqual(variable.Id, result.Handle); Assert.IsNull(result.HexValue); Assert.AreEqual(variable.Value.Substring(7), result.StringValue); Assert.AreEqual(result.Type, NodeExpressionType.Expandable); Assert.AreEqual(NodeVariableType.Error, result.TypeName); }
public void CreateArrayEvaluationResult() { // Arrange var variable = new MockNodeVariable { Id = 19, Parent = null, StackFrame = null, Name = "v_array", TypeName = "object", Value = null, Class = "Array", Text = null }; var factory = new EvaluationResultFactory(); // Act NodeEvaluationResult result = factory.Create(variable); // Assert Assert.IsNotNull(result); Assert.AreEqual(variable.Name, result.Expression); Assert.IsNull(result.Frame); Assert.AreEqual(variable.Name, result.FullName); Assert.AreEqual(variable.Id, result.Handle); Assert.IsNull(result.HexValue); Assert.AreEqual(string.Format("{{{0}}}", variable.Class), result.StringValue); Assert.AreEqual(result.Type, NodeExpressionType.Expandable); Assert.AreEqual(NodeVariableType.Object, result.TypeName); }
public void CreateFunctionWithTextEvaluationResult() { // Arrange var variable = new MockNodeVariable { Id = 23, Parent = null, StackFrame = null, Name = "v_function", TypeName = "function", Value = "55", Class = null, Text = "function(){...}" }; var factory = new EvaluationResultFactory(); // Act NodeEvaluationResult result = factory.Create(variable); // Assert Assert.IsNotNull(result); Assert.AreEqual(variable.Name, result.Expression); Assert.IsNull(result.Frame); Assert.AreEqual(variable.Name, result.FullName); Assert.AreEqual(variable.Id, result.Handle); Assert.IsNull(result.HexValue); Assert.AreEqual(variable.Text, result.StringValue); Assert.AreEqual(NodeExpressionType.Function | NodeExpressionType.Expandable, result.Type); Assert.AreEqual(NodeVariableType.Function, result.TypeName); }
public void CreateEvaluationResultForPrototypeChild() { // Arrange const string parentName = "parent"; var variable = new MockNodeVariable { Id = 19, Parent = new NodeEvaluationResult( 0, null, null, "Object", NodeVariableType.Prototype, parentName + "." + NodeVariableType.Prototype, NodeExpressionType.Expandable, null), StackFrame = null, Name = "name", TypeName = "number", Value = "0", Class = "Number", Text = null }; var factory = new EvaluationResultFactory(); // Act NodeEvaluationResult result = factory.Create(variable); // Assert Assert.IsNotNull(result); Assert.AreEqual(variable.Name, result.Expression); Assert.IsNull(result.Frame); Assert.AreEqual(string.Format(@"{0}.{1}", parentName, variable.Name), result.FullName); Assert.AreEqual(variable.Id, result.Handle); Assert.AreEqual(string.Format("0x{0:x}", int.Parse(variable.Value)), result.HexValue); Assert.AreEqual(variable.Value, result.StringValue); Assert.AreEqual(result.Type, NodeExpressionType.None); Assert.AreEqual(NodeVariableType.Number, result.TypeName); }