public void GetClrTypeForUntypedDelta_Throws_UnsupportedEdmType()
        {
            IEdmTypeReference edmType = new EdmRowTypeReference(new EdmRowType(), isNullable: true);

            Assert.Throws <InvalidOperationException>(
                () => EdmStructuredObject.GetClrTypeForUntypedDelta(edmType),
                "The EDM type '[Row() Nullable=True]' of kind 'Row' is not supported.");
        }
        public void GetDefaultValue_NonNullableEntity()
        {
            IEdmTypeReference nonNullableEntityType = new EdmEntityTypeReference(new EdmEntityType("NS", "Entity"), isNullable: false);

            var result = EdmStructuredObject.GetDefaultValue(nonNullableEntityType);

            var entityObject = Assert.IsType <EdmEntityObject>(result);

            Assert.Equal(nonNullableEntityType, entityObject.GetEdmType(), new EdmTypeReferenceEqualityComparer());
        }
        public void GetDefaultValue_NonNullableEntityCollection()
        {
            IEdmTypeReference           elementType          = new EdmEntityTypeReference(new EdmEntityType("NS", "Entity"), isNullable: true);
            IEdmCollectionTypeReference entityCollectionType = new EdmCollectionTypeReference(new EdmCollectionType(elementType), isNullable: false);

            var result = EdmStructuredObject.GetDefaultValue(entityCollectionType);

            var entityCollectionObject = Assert.IsType <EdmEntityObjectCollection>(result);

            Assert.Equal(entityCollectionType, entityCollectionObject.GetEdmType(), new EdmTypeReferenceEqualityComparer());
        }
 public void GetClrTypeForUntypedDelta(IEdmTypeReference edmType, Type expectedType)
 {
     Assert.Equal(expectedType, EdmStructuredObject.GetClrTypeForUntypedDelta(edmType));
 }
 public void GetDefaultValue(IEdmTypeReference edmType, object expectedResult)
 {
     Assert.Equal(expectedResult, EdmStructuredObject.GetDefaultValue(edmType));
 }