public void CsdlSemanticsTypeDefinitionDefinitionUnitTest()
 {
     CsdlTypeDefinition typeDefinition = new CsdlTypeDefinition("Length", "Edm.String", new CsdlLocation(5, 6));
     CsdlSemanticsTypeDefinitionDefinition typeDefinitionDefinition = new CsdlSemanticsTypeDefinitionDefinition(null, typeDefinition);
     ((IEdmTypeDefinition)typeDefinitionDefinition).UnderlyingType.PrimitiveKind.Should().Be(EdmPrimitiveTypeKind.String);
     ((IEdmSchemaElement)typeDefinitionDefinition).SchemaElementKind.Should().Be(EdmSchemaElementKind.TypeDefinition);
     ((IEdmNamedElement)typeDefinitionDefinition).Name.Should().Be("Length");
     typeDefinitionDefinition.TypeKind.Should().Be(EdmTypeKind.TypeDefinition);
     typeDefinitionDefinition.Element.Should().Be(typeDefinition);
 }
        private IEnumerable <IEdmSchemaType> ComputeTypes()
        {
            List <IEdmSchemaType> types = new List <IEdmSchemaType>();

            foreach (var typeDefinition in schema.TypeDefinitions)
            {
                CsdlSemanticsTypeDefinitionDefinition edmTypeDefinition =
                    new CsdlSemanticsTypeDefinitionDefinition(this, typeDefinition);
                this.AttachDefaultPrimitiveValueConverter(typeDefinition, edmTypeDefinition);
                types.Add(edmTypeDefinition);
            }

            foreach (var structuredType in this.schema.StructuredTypes)
            {
                CsdlEntityType entity = structuredType as CsdlEntityType;
                if (entity != null)
                {
                    types.Add(new CsdlSemanticsEntityTypeDefinition(this, entity));
                }
                else
                {
                    CsdlComplexType complex = structuredType as CsdlComplexType;
                    if (complex != null)
                    {
                        types.Add(new CsdlSemanticsComplexTypeDefinition(this, complex));
                    }
                }
            }

            foreach (var enumType in this.schema.EnumTypes)
            {
                types.Add(new CsdlSemanticsEnumTypeDefinition(this, enumType));
            }

            return(types);
        }