public void AddTypeNameAnnotationAsNeeded_DoesNotAddAnnotation() { // Arrange ODataEnumValue enumValue = new ODataEnumValue("value"); IEdmEnumTypeReference enumType = new EdmEnumTypeReference( new EdmEnumType("TestModel", "EnumType"), isNullable: false); // Act ODataEnumSerializer.AddTypeNameAnnotationAsNeeded(enumValue, enumType, ODataMetadataLevel.MinimalMetadata); // Assert ODataTypeAnnotation annotation = enumValue.TypeAnnotation; Assert.Null(annotation); }
public void AddTypeNameAnnotationAsNeeded_DoesNotAddAnnotation(ODataMetadataLevel metadataLevel) { // Arrange ODataEnumValue enumValue = new ODataEnumValue("value"); IEdmEnumTypeReference enumType = new EdmEnumTypeReference( new EdmEnumType("TestModel", "EnumType"), isNullable: false); // Act ODataEnumSerializer.AddTypeNameAnnotationAsNeeded(enumValue, enumType, metadataLevel); // Assert SerializationTypeNameAnnotation annotation = enumValue.GetAnnotation <SerializationTypeNameAnnotation>(); Assert.Null(annotation); }
public void AddTypeNameAnnotationAsNeeded_AddAnnotation_InFullMetadataMode() { // Arrange ODataEnumValue enumValue = new ODataEnumValue("value"); IEdmEnumTypeReference enumType = new EdmEnumTypeReference( new EdmEnumType("TestModel", "EnumType"), isNullable: false); // Act ODataEnumSerializer.AddTypeNameAnnotationAsNeeded(enumValue, enumType, ODataMetadataLevel.FullMetadata); // Assert SerializationTypeNameAnnotation annotation = enumValue.GetAnnotation <SerializationTypeNameAnnotation>(); Assert.NotNull(annotation); Assert.Equal("TestModel.EnumType", annotation.TypeName); }