Example #1
0
        public void ConstructableTypeReferenceToStringTest()
        {
            IEdmEntityType  astonishing  = new EdmEntityType("AwesomeNamespace", "AstonishingEntity", null, false, false);
            IEdmComplexType breathTaking = new EdmComplexType("AwesomeNamespace", "BreathtakingComplex", null, false);

            IEdmEntityTypeReference          entity      = new EdmEntityTypeReference(astonishing, true);
            IEdmComplexTypeReference         complex     = new EdmComplexTypeReference(breathTaking, true);
            IEdmPrimitiveTypeReference       primitive   = EdmCoreModel.Instance.GetInt32(true);
            IEdmStringTypeReference          stringType  = EdmCoreModel.Instance.GetString(false, 128, false, true);
            IEdmBinaryTypeReference          binary      = EdmCoreModel.Instance.GetBinary(true, null, true);
            IEdmTemporalTypeReference        temporal    = EdmCoreModel.Instance.GetTemporal(EdmPrimitiveTypeKind.DateTimeOffset, 1, true);
            IEdmDecimalTypeReference         decimalType = EdmCoreModel.Instance.GetDecimal(3, 2, true);
            IEdmSpatialTypeReference         spatial     = EdmCoreModel.Instance.GetSpatial(EdmPrimitiveTypeKind.Geography, 1, true);
            IEdmEntityReferenceTypeReference entityRef   = new EdmEntityReferenceTypeReference(new EdmEntityReferenceType(astonishing), true);
            IEdmCollectionTypeReference      collection  = EdmCoreModel.GetCollection(EdmCoreModel.Instance.GetInt32(true));
            IEdmTypeReference type = new EdmEntityTypeReference(astonishing, true);

            Assert.AreEqual("[AwesomeNamespace.AstonishingEntity Nullable=True]", entity.ToString(), "To string correct");
            Assert.AreEqual("[AwesomeNamespace.BreathtakingComplex Nullable=True]", complex.ToString(), "To string correct");
            Assert.AreEqual("[Edm.Int32 Nullable=True]", primitive.ToString(), "To string correct");
            Assert.AreEqual("[Edm.String Nullable=True MaxLength=128 Unicode=False]", stringType.ToString(), "To string correct");
            Assert.AreEqual("[Edm.Binary Nullable=True MaxLength=max]", binary.ToString(), "To string correct");
            Assert.AreEqual("[Edm.DateTimeOffset Nullable=True Precision=1]", temporal.ToString(), "To string correct");
            Assert.AreEqual("[Edm.Decimal Nullable=True Precision=3 Scale=2]", decimalType.ToString(), "To string correct");
            Assert.AreEqual("[Edm.Geography Nullable=True SRID=1]", spatial.ToString(), "To string correct");
            Assert.AreEqual("[Collection([Edm.Int32 Nullable=True]) Nullable=True]", collection.ToString(), "To string correct");
            Assert.AreEqual("[EntityReference(AwesomeNamespace.AstonishingEntity) Nullable=True]", entityRef.ToString(), "To string correct");
            Assert.AreEqual("[AwesomeNamespace.AstonishingEntity Nullable=True]", type.ToString(), "To string correct");
        }
        public static IEdmModel InterfaceCriticalPropertyValueMustNotBeNullUsingEntityReferenceTypeModel()
        {
            var model      = new EdmModel();
            var badTypeRef = new EdmEntityReferenceTypeReference(new CustomEntityReferenceType(null), true);
            var valueTerm  = new EdmTerm("NS", "Note", badTypeRef);

            model.AddElement(valueTerm);

            return(model);
        }