Example #1
0
        public void GetClrTypeNameShouldReturnSystemNullableStructureTemplate()
        {
            EdmPrimitiveType  edmPrimitiveType = new EdmPrimitiveType(EdmPrimitiveTypeKind.DateTimeOffset);
            IEdmTypeReference edmTypeReference = new EdmTypeReferenceForTest(edmPrimitiveType, true);

            ODataT4CodeGenerator.Utils.GetClrTypeName(edmTypeReference, false, template, context).Should().Be("global::System.Nullable<global::System.DateTimeOffset>");
        }
Example #2
0
        public void GetClrTypeNameShouldReturnPrimitiveTypeNameForNullableIEdmPrimitiveType()
        {
            EdmPrimitiveType  edmPrimitiveType = new EdmPrimitiveType(EdmPrimitiveTypeKind.String);
            IEdmTypeReference edmTypeReference = new EdmTypeReferenceForTest(edmPrimitiveType, true);

            ODataT4CodeGenerator.Utils.GetClrTypeName(edmTypeReference, false, template, context).Should().Be("string");
        }
Example #3
0
        public void GetPropertyInitializationValueShouldNotThrowOnPropertyNotInCollectionType()
        {
            EdmPrimitiveType   primitiveType    = new EdmPrimitiveType(EdmPrimitiveTypeKind.String);
            IEdmTypeReference  edmTypeReference = new EdmTypeReferenceForTest(primitiveType, false);
            EdmPropertyForTest property         = new EdmPropertyForTest(new EdmStructruedTypeForTest(), "propertyName", edmTypeReference);

            ODataT4CodeGenerator.Utils.GetPropertyInitializationValue(property, false, template, context).Should().BeNull();
        }
Example #4
0
        public void GetClrTypeNameShouldReturnObjectModelCollectionStructureTemplate()
        {
            EdmPrimitiveType   primitiveType           = new EdmPrimitiveType(EdmPrimitiveTypeKind.String);
            IEdmTypeReference  elementTypeReference    = new EdmTypeReferenceForTest(primitiveType, false);
            IEdmCollectionType collectionType          = new EdmCollectionType(elementTypeReference);
            IEdmTypeReference  collectionTypeReference = new EdmTypeReferenceForTest(collectionType, false);

            ODataT4CodeGenerator.Utils.GetClrTypeName(collectionTypeReference, false, template, context).Should().Be("global::System.Collections.ObjectModel.Collection<string>");
        }
Example #5
0
        public void GetPropertyInitializationValueShouldReturnConstructorWithNoParametersForElementsInPrimitiveType()
        {
            EdmPrimitiveType            primitiveType           = new EdmPrimitiveType(EdmPrimitiveTypeKind.String);
            IEdmTypeReference           elementTypeReference    = new EdmTypeReferenceForTest(primitiveType, false);
            IEdmCollectionType          collectionType          = new EdmCollectionType(elementTypeReference);
            IEdmCollectionTypeReference collectionTypeReference = new EdmCollectionTypeReference(collectionType);
            EdmPropertyForTest          property = new EdmPropertyForTest(new EdmStructruedTypeForTest(), "propertyName", collectionTypeReference);

            ODataT4CodeGenerator.Utils.GetPropertyInitializationValue(property, false, template, context).Should().Be("new global::System.Collections.ObjectModel.Collection<string>()");
        }
Example #6
0
 public void GetPropertyInitializationValueShouldReturnConstructorWithNoParametersForElementsInPrimitiveType()
 {
     EdmPrimitiveType primitiveType = new EdmPrimitiveType(EdmPrimitiveTypeKind.String);
     IEdmTypeReference elementTypeReference = new EdmTypeReferenceForTest(primitiveType, false);
     IEdmCollectionType collectionType = new EdmCollectionType(elementTypeReference);
     IEdmCollectionTypeReference collectionTypeReference = new EdmCollectionTypeReference(collectionType);
     EdmPropertyForTest property = new EdmPropertyForTest(new EdmStructruedTypeForTest(), "propertyName", collectionTypeReference);
     ODataT4CodeGenerator.Utils.GetPropertyInitializationValue(property, false, template, context).Should().Be("new global::System.Collections.ObjectModel.Collection<string>()");
 }
Example #7
0
 public void GetPropertyInitializationValueShouldNotThrowOnPropertyNotInCollectionType()
 {
     EdmPrimitiveType primitiveType = new EdmPrimitiveType(EdmPrimitiveTypeKind.String);
     IEdmTypeReference edmTypeReference = new EdmTypeReferenceForTest(primitiveType, false);
     EdmPropertyForTest property = new EdmPropertyForTest(new EdmStructruedTypeForTest(), "propertyName", edmTypeReference);
     ODataT4CodeGenerator.Utils.GetPropertyInitializationValue(property, false, template, context).Should().BeNull();
 }
Example #8
0
 public void GetClrTypeNameShouldReturnICollectionStructureTemplateForCollectionOfPrimitiveType()
 {
     EdmPrimitiveType primitiveType = new EdmPrimitiveType(EdmPrimitiveTypeKind.String);
     IEdmTypeReference elementTypeReference = new EdmTypeReferenceForTest(primitiveType, false);
     IEdmCollectionType collectionType = new EdmCollectionType(elementTypeReference);
     IEdmTypeReference collectionTypeReference = new EdmTypeReferenceForTest(collectionType, false);
     ODataT4CodeGenerator.Utils.GetClrTypeName(collectionTypeReference, false, template, context, true, true, true)
         .Should().Be("global::System.Collections.Generic.ICollection<string>");
 }
Example #9
0
 public void GetClrTypeNameShouldReturnSystemNullableStructureTemplate()
 {
     EdmPrimitiveType edmPrimitiveType = new EdmPrimitiveType(EdmPrimitiveTypeKind.DateTimeOffset);
     IEdmTypeReference edmTypeReference = new EdmTypeReferenceForTest(edmPrimitiveType, true);
     ODataT4CodeGenerator.Utils.GetClrTypeName(edmTypeReference, false, template, context).Should().Be("global::System.Nullable<global::System.DateTimeOffset>");
 }
Example #10
0
 public void GetClrTypeNameShouldReturnPrimitiveTypeNameForNullableIEdmPrimitiveType()
 {
     EdmPrimitiveType edmPrimitiveType = new EdmPrimitiveType(EdmPrimitiveTypeKind.String);
     IEdmTypeReference edmTypeReference = new EdmTypeReferenceForTest(edmPrimitiveType, true);
     ODataT4CodeGenerator.Utils.GetClrTypeName(edmTypeReference, false, template, context).Should().Be("string");
 }