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>"); }
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"); }
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(); }
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>"); }
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>()"); }
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>"); }