public void TestCoreVocabularyComplexType(string typeName, string properties, string baseType) { var schemaType = this.coreVocModel.FindDeclaredType("Org.OData.Core.V1." + typeName); Assert.NotNull(schemaType); Assert.Equal(EdmTypeKind.Complex, schemaType.TypeKind); IEdmComplexType complex = (IEdmComplexType)(schemaType); Assert.False(complex.IsAbstract); Assert.False(complex.IsOpen); if (baseType == null) { Assert.Null(complex.BaseType); } else { Assert.Equal("Org.OData.Core.V1." + baseType, complex.BaseType.FullTypeName()); } Assert.NotEmpty(complex.DeclaredProperties); Assert.Equal(properties, string.Join("|", complex.DeclaredProperties.Select(e => e.Name))); if (typeName != "EntityExampleValue") { Assert.Empty(complex.DeclaredNavigationProperties()); } else { Assert.Equal(properties, string.Join("|", complex.DeclaredNavigationProperties().Select(e => e.Name))); } }
public void TestAuthorizationVocabularyComplexType(string typeName, string baseName, string properties, bool isAbstract) { var schemaType = this._authorizationModel.FindDeclaredType("Org.OData.Authorization.V1." + typeName); Assert.NotNull(schemaType); Assert.Equal(EdmTypeKind.Complex, schemaType.TypeKind); IEdmComplexType complex = (IEdmComplexType)(schemaType); Assert.Equal(isAbstract, complex.IsAbstract); Assert.False(complex.IsOpen); if (baseName != null) { Assert.NotNull(complex.BaseType); var baseType = this._authorizationModel.FindDeclaredType("Org.OData.Authorization.V1." + baseName); Assert.NotNull(baseType); Assert.Same(baseType, complex.BaseType); } else { Assert.Null(complex.BaseType); } Assert.NotEmpty(complex.DeclaredProperties); Assert.Equal(properties, string.Join("|", complex.DeclaredProperties.Select(e => e.Name))); Assert.Empty(complex.DeclaredNavigationProperties()); }
public void TestValidationVocabularyComplexType(string typeName, string properties) { var schemaType = this._validationModel.FindDeclaredType("Org.OData.Validation.V1." + typeName); Assert.NotNull(schemaType); Assert.Equal(EdmTypeKind.Complex, schemaType.TypeKind); IEdmComplexType complex = (IEdmComplexType)(schemaType); Assert.False(complex.IsAbstract); Assert.False(complex.IsOpen); Assert.Null(complex.BaseType); Assert.NotEmpty(complex.DeclaredProperties); Assert.Equal(properties, string.Join("|", complex.DeclaredProperties.Select(e => e.Name))); Assert.Empty(complex.DeclaredNavigationProperties()); }
private void VisitComplexType(IEdmComplexType complex) { string qualifiedName = complex.FullTypeName(); if (_types.ContainsKey(qualifiedName)) { return; // processed } MetaComplexType metaComplex = new MetaComplexType(); metaComplex.QualifiedName = qualifiedName; metaComplex.Name = complex.Name; metaComplex.Abstract = complex.IsAbstract; _types[qualifiedName] = metaComplex; VisitProperties(metaComplex, complex.DeclaredProperties); VisitNavProperties(metaComplex, complex.DeclaredNavigationProperties()); }