예제 #1
0
        public void CreateLookupVariableWithNullJsonReferences()
        {
            // Arrange
            var                parent    = new NodeEvaluationResult(0, null, null, null, null, null, NodeExpressionType.None, null);
            JObject            json      = SerializationTestData.GetLookupJsonProperty();
            Exception          exception = null;
            NodeLookupVariable result    = null;

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

            // Assert
            Assert.IsNull(result);
            Assert.IsNotNull(exception);
            Assert.IsInstanceOfType(exception, typeof(ArgumentNullException));
        }
예제 #2
0
        public void CreateLookupVariableWithNullParent()
        {
            // Arrange
            JObject json = SerializationTestData.GetLookupJsonProperty();
            Dictionary <int, JToken> references = SerializationTestData.GetLookupJsonReferences();

            // Act
            var result = new NodeLookupVariable(null, json, references);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(NodePropertyAttributes.None, result.Attributes);
            Assert.IsNull(result.Class);
            Assert.AreEqual(54, result.Id);
            Assert.AreEqual("first", result.Name);
            Assert.IsNull(result.Parent);
            Assert.IsNull(result.StackFrame);
            Assert.AreEqual("1", result.Text);
            Assert.AreEqual(NodePropertyType.Field, result.Type);
            Assert.AreEqual("number", result.TypeName);
            Assert.AreEqual("1", result.Value);
        }