Example #1
0
        public void TryGetPropertyValue_ReturnsFalse_IfPropertyDoesNotExist()
        {
            EdmComplexType edmType   = new EdmComplexType("NS", "Complex");
            var            edmObject = new TestEdmStructuredObject(edmType);

            object propertyValue;
            bool   result = edmObject.TryGetPropertyValue("NotPresentProperty", out propertyValue);

            Assert.False(result);
        }
Example #2
0
        public void TryGetPropertyValue_ReturnsTrue_IfPropertyExists()
        {
            EdmComplexType edmType = new EdmComplexType("NS", "Complex");

            edmType.AddStructuralProperty("Property", EdmPrimitiveTypeKind.Int32);
            var edmObject = new TestEdmStructuredObject(edmType);

            object propertyValue;
            bool   result = edmObject.TryGetPropertyValue("Property", out propertyValue);

            Assert.True(result);
        }
Example #3
0
        public void TryGetPropertyValue_Without_TrySetPropertyValue_ReturnsDefault()
        {
            string         propertyName = "Property";
            EdmComplexType edmType      = new EdmComplexType("NS", "Complex");

            edmType.AddStructuralProperty(propertyName, EdmPrimitiveTypeKind.Int32, isNullable: false);
            var edmObject = new TestEdmStructuredObject(edmType);

            object result;

            edmObject.TryGetPropertyValue(propertyName, out result);

            Assert.Equal(0, result);
        }
Example #4
0
        public void TryGetPropertyValue_After_TrySetPropertyValue()
        {
            string         propertyName = "Property";
            EdmComplexType edmType      = new EdmComplexType("NS", "Complex");

            edmType.AddStructuralProperty(propertyName, EdmPrimitiveTypeKind.Int32);
            var    edmObject     = new TestEdmStructuredObject(edmType);
            object propertyValue = new object();

            object result;

            edmObject.TrySetPropertyValue(propertyName, propertyValue);
            edmObject.TryGetPropertyValue(propertyName, out result);

            Assert.Same(propertyValue, result);
        }
        public void TryGetPropertyValue_Without_TrySetPropertyValue_ReturnsDefault()
        {
            string propertyName = "Property";
            EdmComplexType edmType = new EdmComplexType("NS", "Complex");
            edmType.AddStructuralProperty(propertyName, EdmPrimitiveTypeKind.Int32, isNullable: false);
            var edmObject = new TestEdmStructuredObject(edmType);

            object result;
            edmObject.TryGetPropertyValue(propertyName, out result);

            Assert.Equal(0, result);
        }
        public void TryGetPropertyValue_After_TrySetPropertyValue()
        {
            string propertyName = "Property";
            EdmComplexType edmType = new EdmComplexType("NS", "Complex");
            edmType.AddStructuralProperty(propertyName, EdmPrimitiveTypeKind.Int32);
            var edmObject = new TestEdmStructuredObject(edmType);
            object propertyValue = new object();

            object result;
            edmObject.TrySetPropertyValue(propertyName, propertyValue);
            edmObject.TryGetPropertyValue(propertyName, out result);

            Assert.Same(propertyValue, result);
        }
        public void TryGetPropertyValue_ReturnsFalse_IfPropertyDoesNotExist()
        {
            EdmComplexType edmType = new EdmComplexType("NS", "Complex");
            var edmObject = new TestEdmStructuredObject(edmType);

            object propertyValue;
            bool result = edmObject.TryGetPropertyValue("NotPresentProperty", out propertyValue);

            Assert.False(result);
        }
        public void TryGetPropertyValue_ReturnsTrue_IfPropertyExists()
        {
            EdmComplexType edmType = new EdmComplexType("NS", "Complex");
            edmType.AddStructuralProperty("Property", EdmPrimitiveTypeKind.Int32);
            var edmObject = new TestEdmStructuredObject(edmType);

            object propertyValue;
            bool result = edmObject.TryGetPropertyValue("Property", out propertyValue);

            Assert.True(result);
        }