Ejemplo n.º 1
0
        public void ComplexType_reference_extensions()
        {
            IEdmModel       edmModel           = this.GetEdmModel();
            IEdmComplexType derivedComplexType = edmModel.SchemaElements.OfType <IEdmComplexType>().First(c => c.BaseType != null);
            IEdmComplexType baseComplexType    = derivedComplexType.BaseComplexType();

            Assert.IsNotNull(baseComplexType, "Base complex type should not be null!");

            IEdmComplexTypeReference derivedComplexTypeRef = (IEdmComplexTypeReference)derivedComplexType.ToTypeReference();

            Assert.AreEqual(baseComplexType, derivedComplexTypeRef.BaseComplexType(), "ComplexTypeReference.BaseComplexType()");
            Assert.AreEqual(baseComplexType, derivedComplexTypeRef.BaseType(), "ComplexTypeReference.BaseType()");

            Assert.AreEqual(derivedComplexType.IsAbstract, derivedComplexTypeRef.IsAbstract(), "StructuralTypeReference.IsAbstract()");
            Assert.AreEqual(derivedComplexType.IsOpen, derivedComplexTypeRef.IsOpen(), "StructuralTypeReference.IsOpen()");

            Assert.AreEqual(derivedComplexType.DeclaredStructuralProperties().Count(), derivedComplexTypeRef.DeclaredStructuralProperties().Count(), "StructuralTypeReference.DeclaredStructuralProperties()");
            Assert.AreEqual(derivedComplexType.StructuralProperties().Count(), derivedComplexTypeRef.StructuralProperties().Count(), "StructuralTypeReference.StructuralProperties()");
        }