コード例 #1
0
        public void RoundTripValueAnnotationWithCollectionComplexTypeCsdl()
        {
            var expectedErrors = new EdmLibTestErrors();
            this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationWithCollectionComplexTypeCsdl(), EdmVersion.V40, expectedErrors);

            this.RoundTripValidator(VocabularyTestModelBuilder.ValueAnnotationWithCollectionComplexTypeCsdl(), EdmVersion.V40);
        }
コード例 #2
0
 public void CannotReconcilePrimitiveExpressionWithNonPrimitiveType()
 {
     var expectedErrors = new EdmLibTestErrors() 
     {
         {5, 6, EdmErrorCode.PrimitiveConstantExpressionNotValidForNonPrimitiveType}
     };
     this.VerifySemanticValidation(ExpressionValidationTestModelBuilder.PrimitiveForNonPrimitiveTerm(this.EdmVersion), expectedErrors);
 }
コード例 #3
0
 public void NullCannotBeAssertedToBeANonNullableType()
 {
     var expectedErrors = new EdmLibTestErrors() 
     {
         {6, 8, EdmErrorCode.NullCannotBeAssertedToBeANonNullableType}
     };
     this.VerifySemanticValidation(ExpressionValidationTestModelBuilder.NullForNonNullableTerm(this.EdmVersion), expectedErrors);
 }
コード例 #4
0
 public void ValidateAnnotationElementFullNameShouldBeUnique()
 {
     var expectedErrors = new EdmLibTestErrors()
     {
         { null, null, EdmErrorCode.DuplicateDirectValueAnnotationFullName}
     };
     this.VerifySemanticValidation(ValidationTestModelBuilder.AnnotationElementFullNameShouldBeUnique(this.EdmVersion), expectedErrors);
 }
コード例 #5
0
 public void ValidatePropertyRefAnnotationElementSupportInV40()
 {
     var expectedErrors = new EdmLibTestErrors()
     {
         // [EdmLib] Key, ReturnType, Schema, Principle, Dependent, OnDelete do not support annotations. - won't fixed. 
     };
     this.VerifySemanticValidation(ValidationTestModelBuilder.PropertyRefAnnotationElementSupportInV40(this.EdmVersion), expectedErrors);
 }
コード例 #6
0
 public void BadCollectionTermItemOfIncorrectType()
 {
     var expectedErrors = new EdmLibTestErrors()
     {
         {9, 14, EdmErrorCode.ExpressionPrimitiveKindNotValidForAssertedType}
     };
     this.VerifySemanticValidation(ExpressionValidationTestModelBuilder.BadCollectionTermItemOfIncorrectType(this.EdmVersion), expectedErrors);
 }
コード例 #7
0
 public void ValidateNavigationMultiplePrincipalWithAllNullableDependentCsdl()
 {
     var expectedErrors = new EdmLibTestErrors()
     {
         { null, null, EdmErrorCode.InvalidMultiplicityOfPrincipalEnd }
     };
     this.VerifySemanticValidation(NavigationTestModelBuilder.NavigationMultiplePrincipalWithAllNullableDependentCsdl(), EdmVersion.V40, expectedErrors);
 }
コード例 #8
0
 public void IncorrectPrimitiveTypeForTerm()
 {
     var expectedErrors = new EdmLibTestErrors() 
     {
         {5, 6, EdmErrorCode.ExpressionPrimitiveKindNotValidForAssertedType}
     };
     this.VerifySemanticValidation(ExpressionValidationTestModelBuilder.IncorrectPrimitiveTypeForTerm(this.EdmVersion), expectedErrors);
 }
コード例 #9
0
        public void ValueTerm_NameConflict_WithOthers()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                {3, 4, EdmErrorCode.AlreadyDefined},
            };

            this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueTermNameConflictWithOthersCsdl(), expectedErrors);
        }
コード例 #10
0
        public void ValueAnnotation_TargetNotResolvable()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                {8, 6, EdmErrorCode.BadUnresolvedType},
            };

            this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationTargetNotResolvableCsdl(), expectedErrors);
        }
コード例 #11
0
        public void ValidateEntityContainerAnnotationElementSupportInV40()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                { 5, 6, EdmErrorCode.DuplicateDirectValueAnnotationFullName}, 
            };

            this.VerifySemanticValidation(ValidationTestModelBuilder.EntityContainerAnnotationElementSupportInV40(EdmVersion.V40), EdmVersion.V40, expectedErrors);
        }
コード例 #12
0
        public void ValidateValueAnnotationInvalidFloatConstantAttributeCsdl()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                { null, null, EdmErrorCode.InvalidFloatingPoint }
            };

            this.VerifySemanticValidation(ConstantExpressionModelBuilder.ValueAnnotationInvalidFloatConstantAttributeCsdl(), EdmVersion.V40, expectedErrors);
        }
コード例 #13
0
 public void SerializerTestNoContentModel()
 {
     IEnumerable<EdmError> actualSerializationErrors;
     IEnumerable<EdmError> expectedSerializationErrors = new EdmLibTestErrors() 
     {
         {0, 0, EdmErrorCode.NoSchemasProduced},
     };
     IEnumerable<string> csdlStrings = this.GetSerializerResult(new EdmModel(), out actualSerializationErrors);
     Assert.AreEqual(0, csdlStrings.Count(), "CsdlWriter.WriteCsdl should not generate no ");
     CompareErrors(actualSerializationErrors, expectedSerializationErrors);
 }
コード例 #14
0
        public void TestInterfaceCriticalKindValueMismatchOnlyModel()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                { null, null, EdmErrorCode.InterfaceCriticalKindValueMismatch }
            };

            var model = InterfaceCriticalModelBuilder.InterfaceCriticalKindValueMismatchOnlyModel();

            this.ValidateUsingEdmValidator(model, expectedErrors);
            this.ValidateUsingEdmValidator(model, EdmConstants.EdmVersion4, expectedErrors);
            this.ValidateUsingEdmValidator(model, ValidationRuleSet.GetEdmModelRuleSet(EdmConstants.EdmVersion4), expectedErrors);
        }
コード例 #15
0
        public void TestInterfaceCriticalPropertyValueMustNotBeNullCsdl()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                { null, null, EdmErrorCode.InterfaceCriticalPropertyValueMustNotBeNull }
            };

            var csdls = InterfaceCriticalModelBuilder.InterfaceCriticalPropertyValueMustNotBeNullOnlyCsdl();
            var model = this.GetParserResult(csdls);

            this.ValidateUsingEdmValidator(model, expectedErrors);
            this.ValidateUsingEdmValidator(model, EdmConstants.EdmVersion4, expectedErrors);
            this.ValidateUsingEdmValidator(model, ValidationRuleSet.GetEdmModelRuleSet(EdmConstants.EdmVersion4), expectedErrors);
        }
コード例 #16
0
        public void TestInterfaceCriticalNavigationPartnerInvalidOnlyCsdl()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                { null, null, EdmErrorCode.InterfaceCriticalNavigationPartnerInvalid },
                { null, null, EdmErrorCode.BadUnresolvedNavigationPropertyPath }
            };

            var csdls = InterfaceCriticalModelBuilder.InterfaceCriticalNavigationPartnerInvalidOnlyCsdl();
            var model = this.GetParserResult(csdls);

            this.ValidateUsingEdmValidator(model, expectedErrors);
            this.ValidateUsingEdmValidator(model, ValidationRuleSet.GetEdmModelRuleSet(EdmConstants.EdmVersion4), expectedErrors);
            this.ValidateUsingEdmValidator(model, EdmConstants.EdmVersion4, expectedErrors);
        }
コード例 #17
0
        public void TestElementInterfaceCriticalKindValueMismatch()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                { null, null, EdmErrorCode.InterfaceCriticalKindValueMismatch }
            };

            var model = InterfaceCriticalModelBuilder.InterfaceCriticalKindValueMismatchOnlyModel();

            this.ValidateElement(model, expectedErrors);

            var valueAnnotation = model.VocabularyAnnotations.ElementAt(0);

            this.ValidateElement(valueAnnotation, expectedErrors);

            var annotationValue = valueAnnotation.Value;

            this.ValidateElement(annotationValue, expectedErrors);
        }
コード例 #18
0
        public void TestManytoManyRelationshipWithOneNavigiationPropertyInOneOfThem()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                { null, null, EdmErrorCode.InterfaceCriticalNavigationPartnerInvalid }
            };

            var entity1 = new EdmEntityType("DefaultNamespace", "Entity1");
            var entity2 = new EdmEntityType("DefaultNamespace", "Entity2");

            var navProperty1 = new StubEdmNavigationProperty("Nav1")
            {
                DeclaringType = entity1,
                Type          = new EdmEntityTypeReference(entity2, false),
            };

            var navProperty2 = new StubEdmNavigationProperty("Nav2")
            {
                DeclaringType = entity1,
                Type          = new EdmEntityTypeReference(entity2, false),
            };

            var navProperty3 = new StubEdmNavigationProperty("Nav3")
            {
                DeclaringType = entity2,
                Type          = new EdmEntityTypeReference(entity1, false),
            };

            navProperty1.Partner = navProperty3;
            navProperty2.Partner = navProperty3;
            navProperty3.Partner = navProperty1;

            entity1.AddProperty(navProperty1);
            entity1.AddProperty(navProperty2);
            entity2.AddProperty(navProperty3);

            var model = new EdmModel();

            model.AddElement(entity1);
            model.AddElement(entity2);

            this.ValidateUsingEdmValidator(model, expectedErrors);
        }
コード例 #19
0
        public void ValidateNavigationWithInvalidEntitySet()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                { null, null, EdmErrorCode.BadUnresolvedType },
                { null, null, EdmErrorCode.BadUnresolvedType }
            };

            var model = NavigationTestModelBuilder.NavigationWithInvalidEntitySet();

            this.VerifySemanticValidation(model, EdmVersion.V40, expectedErrors);

            expectedErrors = new EdmLibTestErrors()
            {
                { null, null, EdmErrorCode.BadUnresolvedType },
                { null, null, EdmErrorCode.BadUnresolvedType }
            };
            this.VerifySemanticValidation(model, EdmVersion.V40, expectedErrors);
        }
コード例 #20
0
        public void ParserTestEntityTypeWithDuplicateProperties()
        {
            var csdls = ODataTestModelBuilder.InvalidCsdl.EntityTypeWithDuplicateProperties;
            var model = this.GetParserResult(csdls);

            IEdmEntityContainer entityContainer = model.EntityContainer;

            Assert.AreEqual("DefaultContainer", entityContainer.Name, "Invalid entity container name");
            Assert.IsTrue(entityContainer.Elements.Count() == 1, "Entity container has invalid amount of elements");
            Assert.AreEqual(EdmContainerElementKind.EntitySet, entityContainer.Elements.Single().ContainerElementKind, "Invalid container element kind");

            IEdmEntitySet entitySet = (IEdmEntitySet)entityContainer.Elements.Single();

            Assert.AreEqual("DuplicatePropertiesEntityType", entitySet.Name, "Invalid entity set name");
            Assert.AreEqual("TestModel.DuplicatePropertiesEntityType", entitySet.EntityType().FullName(), "Invalid entity set element type");

            Assert.IsTrue(model.SchemaElements.Count() == 2, "Invalid schema element count");

            IEdmEntityType entityType = (IEdmEntityType)model.SchemaElements.First();

            Assert.AreEqual("TestModel.DuplicatePropertiesEntityType", entityType.FullName(), "Invalid entity type full name");
            Assert.AreEqual("DuplicatePropertiesEntityType", entityType.Name, "Invalid entity type name");

            Assert.IsTrue(entityType.Properties().Count() == 3, "Invalid entity type property count");
            Assert.AreEqual(EdmPropertyKind.Structural, entityType.Properties().ElementAt(0).PropertyKind, "Invalid property kind");
            Assert.AreEqual(EdmPropertyKind.Structural, entityType.Properties().ElementAt(1).PropertyKind, "Invalid property kind");
            Assert.AreEqual(EdmPropertyKind.Structural, entityType.Properties().ElementAt(2).PropertyKind, "Invalid property kind");

            Assert.AreEqual("Id", entityType.Properties().ElementAt(0).Name, "Invalid property name");
            Assert.AreEqual("Duplicate", entityType.Properties().ElementAt(1).Name, "Invalid property name");
            Assert.AreEqual("Duplicate", entityType.Properties().ElementAt(2).Name, "Invalid property name");

            var expectedErrors = new EdmLibTestErrors()
            {
                { 12, 10, EdmErrorCode.AlreadyDefined }
            };

            IEnumerable <EdmError> actualErrors = null;

            model.Validate(out actualErrors);
            this.CompareErrors(actualErrors, expectedErrors);
        }
コード例 #21
0
        public void ValidateSerializationBlockingErrors()
        {
            EdmModel model = new EdmModel();

            EdmComplexType complexWithBadProperty = new EdmComplexType("Foo", "Bar");

            complexWithBadProperty.AddProperty(new EdmStructuralProperty(complexWithBadProperty, "baz", new EdmComplexTypeReference(new EdmComplexType("", ""), false)));
            model.AddElement(complexWithBadProperty);

            EdmEntityType          baseType = new EdmEntityType("Foo", "");
            IEdmStructuralProperty keyProp  = new EdmStructuralProperty(baseType, "Id", EdmCoreModel.Instance.GetInt32(false));

            baseType.AddProperty(keyProp);
            baseType.AddKeys(keyProp);

            EdmEntityType derivedType = new EdmEntityType("Foo", "Quip", baseType);

            model.AddElement(baseType);
            model.AddElement(derivedType);
            EdmNavigationProperty navProp = derivedType.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo()
            {
                Name = "navProp", Target = derivedType, TargetMultiplicity = EdmMultiplicity.One
            });

            EdmEntityContainer container = new EdmEntityContainer("Foo", "Container");

            model.AddElement(container);
            container.AddElement(new EdmEntitySet(container, "badNameSet", baseType));

            StringBuilder          sb = new StringBuilder();
            IEnumerable <EdmError> errors;
            bool written        = model.TryWriteSchema(XmlWriter.Create(sb), out errors);
            var  expectedErrors = new EdmLibTestErrors()
            {
                { "([. Nullable=False])", EdmErrorCode.ReferencedTypeMustHaveValidName },
                { "(Foo.Quip)", EdmErrorCode.ReferencedTypeMustHaveValidName },
                { "(Microsoft.OData.Edm.EdmEntitySet)", EdmErrorCode.ReferencedTypeMustHaveValidName },
            };

            this.CompareErrors(errors, expectedErrors);
        }
コード例 #22
0
        public void ParserTestComplexTypeWithDuplicateProperties()
        {
            var csdls = ODataTestModelBuilder.InvalidCsdl.ComplexTypeWithDuplicateProperties;
            var model = this.GetParserResult(csdls);

            IEdmEntityContainer entityContainer = model.EntityContainer;

            Assert.AreEqual("DefaultContainer", entityContainer.Name, "Invalid entity container name");
            Assert.IsTrue(entityContainer.Elements.Count() == 0, "Entity container has invalid amount of elements");

            Assert.IsTrue(model.SchemaElements.Count() == 2, "Invalid schema element count");
            Assert.AreEqual(EdmSchemaElementKind.TypeDefinition, model.SchemaElements.ElementAt(0).SchemaElementKind, "Invalid schema element kind");

            IEdmComplexType complexTypeElement = (IEdmComplexType)model.SchemaElements.ElementAt(0);

            Assert.AreEqual("TestModel.DuplicatePropertiesComplexType", complexTypeElement.FullName(), "Invalid complex type full name");
            Assert.AreEqual("DuplicatePropertiesComplexType", complexTypeElement.Name, "Invalid complex type name");

            Assert.IsTrue(complexTypeElement.DeclaredProperties.Count() == 2, "Invalid complex type property count");
            Assert.AreEqual(EdmPropertyKind.Structural, complexTypeElement.DeclaredProperties.ElementAt(0).PropertyKind, "Invalid property kind");
            Assert.AreEqual(EdmPropertyKind.Structural, complexTypeElement.DeclaredProperties.ElementAt(1).PropertyKind, "Invalid property kind");

            IEdmProperty complexProperty1 = (IEdmProperty)complexTypeElement.DeclaredProperties.ElementAt(0);

            Assert.AreEqual("Duplicate", complexProperty1.Name, "Invalid property name");

            IEdmProperty complexProperty2 = (IEdmProperty)complexTypeElement.DeclaredProperties.ElementAt(1);

            Assert.AreEqual("Duplicate", complexProperty2.Name, "Invalid property name");

            var expectedErrors = new EdmLibTestErrors()
            {
                { 6, 10, EdmErrorCode.AlreadyDefined }
            };

            IEnumerable <EdmError> actualErrors = null;

            model.Validate(out actualErrors);
            this.CompareErrors(actualErrors, expectedErrors);
        }
コード例 #23
0
        protected void CompareErrors(IEnumerable <EdmError> actualErrors, IEnumerable <EdmError> expectedErrors)
        {
            if (expectedErrors == null)
            {
                expectedErrors = new EdmLibTestErrors();
            }

            actualErrors.ToList().ForEach(e => Console.WriteLine(e.ToString()));

            var copyOfExpectedErrors = new List <EdmError>(expectedErrors);

            Assert.AreEqual(expectedErrors.Count(), actualErrors.Count(), "The number of actual errors does not match the expected errors.");
            foreach (var actualError in actualErrors)
            {
                if (actualError.ErrorCode != EdmErrorCode.BadAmbiguousElementBinding)
                {
                    Assert.IsNotNull(actualError.ErrorLocation, "actualError.ErrorLocation");
                }

                // First try to find an expected error with error location
                var expectedErrorWithLocation = copyOfExpectedErrors.FirstOrDefault(e => e.ErrorCode == actualError.ErrorCode && e.ErrorLocation != null && e.ErrorLocation.ToString() == actualError.ErrorLocation.ToString());
                if (expectedErrorWithLocation != null)
                {
                    copyOfExpectedErrors.Remove(expectedErrorWithLocation);
                    continue;
                }

                // Now try to find an expected error with no expected location
                var expectedErrorWithNoLocation = copyOfExpectedErrors.FirstOrDefault(e => e.ErrorCode == actualError.ErrorCode && e.ErrorLocation == null);
                if (expectedErrorWithNoLocation != null)
                {
                    copyOfExpectedErrors.Remove(expectedErrorWithNoLocation);
                    continue;
                }

                Assert.Fail("Unexpected error : " + actualError);
            }

            Assert.AreEqual(0, copyOfExpectedErrors.Count, "Expected errors not found");
        }
コード例 #24
0
        public void TestElementInterfaceCriticalComplexTypeBaseType()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                { null, null, EdmErrorCode.InterfaceCriticalPropertyValueMustNotBeNull },
                { null, null, EdmErrorCode.InterfaceCriticalPropertyValueMustNotBeNull },
            };

            var baseComplexType = new StubEdmComplexType(null, null);
            var property        = new StubEdmStructuralProperty("")
            {
                DeclaringType = baseComplexType
            };

            baseComplexType.Add(property);
            this.ValidateElement(baseComplexType, expectedErrors);

            var derivedComplexType = new EdmComplexType("", "", baseComplexType, false);

            expectedErrors = new EdmLibTestErrors();
            this.ValidateElement(derivedComplexType, expectedErrors);
        }
コード例 #25
0
        public void ParserTestEntityTypeWithoutKey()
        {
            var csdls = ODataTestModelBuilder.InvalidCsdl.EntityTypeWithoutKey;
            var model = this.GetParserResult(csdls);

            Assert.IsTrue(model.SchemaElements.Count() == 2, "Invalid schema element count");

            IEdmEntityType entityType = (IEdmEntityType)model.SchemaElements.First();

            Assert.AreEqual("TestModel.EntityTypeWithoutKey", entityType.FullName(), "Invalid entity type full name");
            Assert.AreEqual("EntityTypeWithoutKey", entityType.Name, "Invalid entity type name");

            IEdmEntityContainer entityContainer = model.EntityContainer;

            Assert.AreEqual("DefaultContainer", entityContainer.Name, "Invalid entity container name");
            Assert.IsTrue(entityContainer.Elements.Count() == 2, "Entity container has invalid amount of elements");

            IEdmEntitySet entitySet = entityContainer.FindEntitySet("EntityTypeWithoutKey");

            Assert.AreEqual("EntityTypeWithoutKey", entitySet.Name, "Invalid entity set name");
            Assert.AreEqual("TestModel.EntityTypeWithoutKey", entitySet.EntityType().FullName(), "Invalid entity set element type");

            IEdmSingleton singleton = entityContainer.FindSingleton("SingletonWhoseEntityTypeWithoutKey");

            Assert.AreEqual("SingletonWhoseEntityTypeWithoutKey", singleton.Name, "Invalid singleton name");
            Assert.AreEqual("TestModel.EntityTypeWithoutKey", singleton.EntityType().FullName(), "Invalid singleton element type");

            var expectedErrors = new EdmLibTestErrors()
            {
                { 4, 10, EdmErrorCode.NavigationSourceTypeHasNoKeys },
                { 7, 6, EdmErrorCode.KeyMissingOnEntityType },
                { 5, 10, EdmErrorCode.NavigationSourceTypeHasNoKeys },
            };

            IEnumerable <EdmError> actualErrors = null;

            model.Validate(out actualErrors);
            this.CompareErrors(actualErrors, expectedErrors);
        }
コード例 #26
0
        public void TestElementInterfaceCriticalNavigationPartnerInvalid()
        {
            var expectedErrors = new EdmLibTestErrors()
            {
                { null, null, EdmErrorCode.InterfaceCriticalNavigationPartnerInvalid }
            };

            var entity1 = new EdmEntityType("DefaultNamespace", "Entity1");
            var entity2 = new EdmEntityType("DefaultNamespace", "Entity2");

            var navProperty = new StubEdmNavigationProperty("Nav")
            {
                DeclaringType = entity1,
                Type          = new EdmEntityTypeReference(entity2, false),
            };

            navProperty.Partner = navProperty;
            entity1.AddProperty(navProperty);

            this.ValidateElement(navProperty, expectedErrors);
            this.ValidateElement(entity1, expectedErrors);
        }
コード例 #27
0
        public void TestElementError()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.ValidateElement(new EdmModel(), expectedErrors);
            this.ValidateElement(new EdmTerm("foo", "bar", EdmCoreModel.Instance.GetInt32(false)), expectedErrors);
            this.ValidateElement(new EdmEntityType("", ""), expectedErrors);
            this.ValidateElement(new EdmComplexType("", ""), expectedErrors);
            this.ValidateElement(new EdmFunction("foo", "bar", EdmCoreModel.Instance.GetStream(true)), expectedErrors);
            this.ValidateElement(new EdmFunctionImport(new EdmEntityContainer("", ""), "foo", new EdmFunction("namespace", "foo", EdmCoreModel.Instance.GetInt32(false))), expectedErrors);
            this.ValidateElement(new EdmEntityType("", "").AddStructuralProperty("foo", EdmCoreModel.Instance.GetString(true)), expectedErrors);
            this.ValidateElement(new EdmEntitySet(new EdmEntityContainer("", ""), "foo", new EdmEntityType("", "")), expectedErrors);
            this.ValidateElement(new EdmEnumType("", ""), expectedErrors);
            this.ValidateElement(EdmNavigationProperty.CreateNavigationPropertyWithPartner(
                                     new EdmNavigationPropertyInfo()
            {
                Name = "", Target = new EdmEntityType("", ""), TargetMultiplicity = EdmMultiplicity.One
            },
                                     new EdmNavigationPropertyInfo()
            {
                Name = "", Target = new EdmEntityType("", ""), TargetMultiplicity = EdmMultiplicity.One
            }), expectedErrors);
        }
コード例 #28
0
        public void XElementAnnotationTestOutOfLineVocabularyAnnotationWithAnnotationModel()
        {
            var model = XElementAnnotationModelBuilder.OutOfLineVocabularyAnnotationWithAnnotationModel();

            var errors = new EdmLibTestErrors();

            this.VerifySemanticValidation(model, EdmVersion.Latest, errors);

            var vocabularyAnnotation = model.VocabularyAnnotations;

            Assert.AreEqual(1, vocabularyAnnotation.Count(), "Invalid vocabulary count.");

            var actualAnnotationValue = (model.GetAnnotationValue(vocabularyAnnotation.Single(), "http://foo", "Annotation") as EdmStringConstant).Value;

            XElement expectedAnnotationValue =
                new XElement("{http://foo}Annotation", "1");

            Assert.IsTrue(expectedAnnotationValue.ToString().Equals(actualAnnotationValue), "XElement annotation are not the same.");

            var serializedModel = ModelBuilderHelpers.ReplaceCsdlNamespacesForEdmVersion(this.GetSerializerResult(model).Select(n => XElement.Parse(n)).ToArray(), EdmVersion.V40).ToList();

            new ConstructiveApiCsdlXElementComparer().Compare(XElementAnnotationModelBuilder.OutOfLineVocabularyAnnotationWithAnnotationCsdl().ToList(), serializedModel);
        }
コード例 #29
0
 public void ValidateConcurrencyModePropertyTypes()
 {
     var expectedErrors = new EdmLibTestErrors()
     {
         {12, 6, EdmErrorCode.InvalidPropertyType },
     };
     this.VerifySemanticValidation(ValidationTestModelBuilder.ConcurrencyModePropertyTypes(this.EdmVersion), expectedErrors);
 }
コード例 #30
0
 public void ValidateStringMaxLengthAndUnbounded()
 {
     var expectedErrors = new EdmLibTestErrors()
     {
         {null, null, EdmErrorCode.IsUnboundedCannotBeTrueWhileMaxLengthIsNotNull },
     };
     this.VerifySemanticValidation(ValidationTestModelBuilder.MaxLengthAndUnbounded(), expectedErrors);
 }
コード例 #31
0
 public void ValidateValidStringMaxLengthValue()
 {
     var expectedErrors = new EdmLibTestErrors()
     {
         {null, null, EdmErrorCode.MaxLengthOutOfRange },
     };
     this.VerifySemanticValidation(ValidationTestModelBuilder.ValidStringMaxLengthValue(), expectedErrors);
 }
コード例 #32
0
        public void ValidateNavigationDuplicatePrincipalPropertyRefCsdl()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(NavigationTestModelBuilder.NavigationDuplicatePrincipalPropertyRefCsdl(), EdmVersion.V40, expectedErrors);
        }
コード例 #33
0
ファイル: ParserTests.cs プロジェクト: AlineGuan/odata.net
        public void ParserTestEntityTypeWithDuplicateProperties()
        {
            var csdls = ODataTestModelBuilder.InvalidCsdl.EntityTypeWithDuplicateProperties;
            var model = this.GetParserResult(csdls);

            IEdmEntityContainer entityContainer = model.EntityContainer;
            Assert.AreEqual("DefaultContainer", entityContainer.Name, "Invalid entity container name");
            Assert.IsTrue(entityContainer.Elements.Count() == 1, "Entity container has invalid amount of elements");
            Assert.AreEqual(EdmContainerElementKind.EntitySet, entityContainer.Elements.Single().ContainerElementKind, "Invalid container element kind");

            IEdmEntitySet entitySet = (IEdmEntitySet)entityContainer.Elements.Single();
            Assert.AreEqual("DuplicatePropertiesEntityType", entitySet.Name, "Invalid entity set name");
            Assert.AreEqual("TestModel.DuplicatePropertiesEntityType", entitySet.EntityType().FullName(), "Invalid entity set element type");

            Assert.IsTrue(model.SchemaElements.Count() == 2, "Invalid schema element count");

            IEdmEntityType entityType = (IEdmEntityType)model.SchemaElements.First();
            Assert.AreEqual("TestModel.DuplicatePropertiesEntityType", entityType.FullName(), "Invalid entity type full name");
            Assert.AreEqual("DuplicatePropertiesEntityType", entityType.Name, "Invalid entity type name");

            Assert.IsTrue(entityType.Properties().Count() == 3, "Invalid entity type property count");
            Assert.AreEqual(EdmPropertyKind.Structural, entityType.Properties().ElementAt(0).PropertyKind, "Invalid property kind");
            Assert.AreEqual(EdmPropertyKind.Structural, entityType.Properties().ElementAt(1).PropertyKind, "Invalid property kind");
            Assert.AreEqual(EdmPropertyKind.Structural, entityType.Properties().ElementAt(2).PropertyKind, "Invalid property kind");

            Assert.AreEqual("Id", entityType.Properties().ElementAt(0).Name, "Invalid property name");
            Assert.AreEqual("Duplicate", entityType.Properties().ElementAt(1).Name, "Invalid property name");
            Assert.AreEqual("Duplicate", entityType.Properties().ElementAt(2).Name, "Invalid property name");

            var expectedErrors = new EdmLibTestErrors()
            {
                { 12, 10, EdmErrorCode.AlreadyDefined }
            };

            IEnumerable<EdmError> actualErrors = null;
            model.Validate(out actualErrors);
            this.CompareErrors(actualErrors, expectedErrors);
        }
コード例 #34
0
ファイル: ParserTests.cs プロジェクト: AlineGuan/odata.net
        public void ParserTestDuplicateComplexTypes()
        {
            var csdls = ODataTestModelBuilder.InvalidCsdl.DuplicateComplexTypes;
            var model = this.GetParserResult(csdls);

            IEdmEntityContainer entityContainer = model.EntityContainer;
            Assert.AreEqual("DefaultContainer", entityContainer.Name, "Invalid entity container name");
            Assert.IsTrue(entityContainer.Elements.Count() == 0, "Entity container has invalid amount of elements");

            Assert.IsTrue(model.SchemaElements.Count() == 3, "Invalid schema element count");
            Assert.AreEqual(EdmSchemaElementKind.TypeDefinition, model.SchemaElements.ElementAt(0).SchemaElementKind, "Invalid schema element kind");
            Assert.AreEqual(EdmSchemaElementKind.TypeDefinition, model.SchemaElements.ElementAt(1).SchemaElementKind, "Invalid schema element kind");

            IEdmComplexType complexTypeElement1 = (IEdmComplexType)model.SchemaElements.ElementAt(0);
            Assert.AreEqual("TestModel.DuplicateComplexTypes", complexTypeElement1.FullName(), "Invalid complex type full name");
            Assert.AreEqual("DuplicateComplexTypes", complexTypeElement1.Name, "Invalid complex type name");

            IEdmComplexType complexTypeElement2 = (IEdmComplexType)model.SchemaElements.ElementAt(1);
            Assert.AreEqual("TestModel.DuplicateComplexTypes", complexTypeElement2.FullName(), "Invalid complex type full name");
            Assert.AreEqual("DuplicateComplexTypes", complexTypeElement2.Name, "Invalid complex type name");

            var expectedErrors = new EdmLibTestErrors()
            {
                { 7, 6, EdmErrorCode.AlreadyDefined }
            };

            IEnumerable<EdmError> actualErrors = null;
            model.Validate(out actualErrors);
            this.CompareErrors(actualErrors, expectedErrors);
        }
コード例 #35
0
ファイル: ParserTests.cs プロジェクト: AlineGuan/odata.net
        public void ParserTestEntityTypeWithoutKey()
        {
            var csdls = ODataTestModelBuilder.InvalidCsdl.EntityTypeWithoutKey;
            var model = this.GetParserResult(csdls);

            Assert.IsTrue(model.SchemaElements.Count() == 2, "Invalid schema element count");

            IEdmEntityType entityType = (IEdmEntityType)model.SchemaElements.First();
            Assert.AreEqual("TestModel.EntityTypeWithoutKey", entityType.FullName(), "Invalid entity type full name");
            Assert.AreEqual("EntityTypeWithoutKey", entityType.Name, "Invalid entity type name");

            IEdmEntityContainer entityContainer = model.EntityContainer;
            Assert.AreEqual("DefaultContainer", entityContainer.Name, "Invalid entity container name");
            Assert.IsTrue(entityContainer.Elements.Count() == 2, "Entity container has invalid amount of elements");
            
            IEdmEntitySet entitySet = entityContainer.FindEntitySet("EntityTypeWithoutKey");
            Assert.AreEqual("EntityTypeWithoutKey", entitySet.Name, "Invalid entity set name");
            Assert.AreEqual("TestModel.EntityTypeWithoutKey", entitySet.EntityType().FullName(), "Invalid entity set element type");

            IEdmSingleton singleton = entityContainer.FindSingleton("SingletonWhoseEntityTypeWithoutKey");
            Assert.AreEqual("SingletonWhoseEntityTypeWithoutKey", singleton.Name, "Invalid singleton name");
            Assert.AreEqual("TestModel.EntityTypeWithoutKey", singleton.EntityType().FullName(), "Invalid singleton element type");
            
            var expectedErrors = new EdmLibTestErrors()
            {
                { 4, 10, EdmErrorCode.NavigationSourceTypeHasNoKeys },
                { 7, 6, EdmErrorCode.KeyMissingOnEntityType },
                { 5, 10, EdmErrorCode.NavigationSourceTypeHasNoKeys },
            };

            IEnumerable<EdmError> actualErrors = null;
            model.Validate(out actualErrors);
            this.CompareErrors(actualErrors, expectedErrors);
        }
コード例 #36
0
        public void ValidateIsTypeResultTrueEvaluationModel()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(ExpressionValidationTestModelBuilder.IsTypeResultTrueEvaluationModel(), expectedErrors);
        }
コード例 #37
0
        public void ValidateCastResultTrueEvaluationCsdl()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(ExpressionValidationTestModelBuilder.CastResultTrueEvaluationCsdl(this.EdmVersion), expectedErrors);
        }
コード例 #38
0
        public void NoErrorsForComplexTypeTerm()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(ExpressionValidationTestModelBuilder.ComplexTypeTerm(this.EdmVersion), expectedErrors);
        }
コード例 #39
0
        //[TestMethod, Variation(Id = 46, SkipReason = @"[EdmLib] [Validator] Validation error is occuring for term property that are nullable -- postponed")]
        public void VocabularyAnnotation_TypeStructure_NullablePropertyUndeclared()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(VocabularyTestModelBuilder.VocabularyAnnotationNullablePropertyUndeclaredCsdl(), expectedErrors);
        }
コード例 #40
0
        public void VocabularyAnnotation_FunctionApplication()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(VocabularyTestModelBuilder.VocabularyAnnotationFunctionCsdl(), expectedErrors);
        }
コード例 #41
0
        public void ValidateTermOnly()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(VocabularyTestModelBuilder.TermOnlyCsdl(), EdmVersion.V40, expectedErrors);
        }
コード例 #42
0
        public void ValidateValueAnnotationWithCollectionComplexTypeModel()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationWithCollectionComplexTypeModel(), expectedErrors);
        }
コード例 #43
0
 public void ValidateBinaryKeyTypeWithNegativeMaxLength()
 {
     var expectedErrors = new EdmLibTestErrors()
     {
         {10, 6, EdmErrorCode.MaxLengthOutOfRange}
     };
     this.VerifySemanticValidation(ValidationTestModelBuilder.BinaryKeyTypeWithNegativeMaxLength(EdmVersion.V40), EdmVersion.V40, expectedErrors);
 }
コード例 #44
0
 public void ValidateNamespaceIsNull()
 {
     var expectedErrors = new EdmLibTestErrors()
     {
         { "(Microsoft.OData.Edm.Library.EdmFunction)", EdmErrorCode.InvalidNamespaceName},
         { "(.ComplexType)", EdmErrorCode.InvalidNamespaceName}
     };
     this.VerifySemanticValidation(ValidationTestModelBuilder.EdmFunctionNamespaceIsEmpty(), expectedErrors);
 }
コード例 #45
0
        public void OkayRecordTerm()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(ExpressionValidationTestModelBuilder.OkayRecordTerm(this.EdmVersion), expectedErrors);
        }
コード例 #46
0
ファイル: ParserTests.cs プロジェクト: AlineGuan/odata.net
        public void ParserTestDuplicateEntityTypes()
        {
            var csdls = ODataTestModelBuilder.InvalidCsdl.DuplicateEntityTypes;
            var model = this.GetParserResult(csdls);

            IEdmEntityContainer entityContainer = model.EntityContainer;
            Assert.AreEqual("DefaultContainer", entityContainer.Name, "Invalid entity container name");
            Assert.IsTrue(entityContainer.Elements.Count() == 2, "Entity container has invalid amount of elements");
            Assert.AreEqual(EdmContainerElementKind.EntitySet, entityContainer.Elements.ElementAt(0).ContainerElementKind, "Invalid container element kind");
            Assert.AreEqual(EdmContainerElementKind.EntitySet, entityContainer.Elements.ElementAt(1).ContainerElementKind, "Invalid container element kind");

            IEdmEntitySet entitySetElement1 = (IEdmEntitySet)entityContainer.Elements.ElementAt(0);
            Assert.AreEqual("DuplicateEntityType", entitySetElement1.Name, "Invalid entity set name");
            Assert.AreEqual("TestModel.DuplicateEntityType", entitySetElement1.EntityType().FullName(), "Invalid entity set element type");

            IEdmEntitySet entitySetElement2 = (IEdmEntitySet)entityContainer.Elements.ElementAt(1);
            Assert.AreEqual("DuplicateEntityType", entitySetElement2.Name, "Invalid entity set name");
            Assert.AreEqual("TestModel.DuplicateEntityType", entitySetElement2.EntityType().FullName(), "Invalid entity set element type");

            Assert.IsTrue(model.SchemaElements.Count() == 3, "Invalid schema element count");
            Assert.AreEqual(EdmSchemaElementKind.TypeDefinition, model.SchemaElements.ElementAt(0).SchemaElementKind, "Invalid schema element kind");
            Assert.AreEqual(EdmSchemaElementKind.TypeDefinition, model.SchemaElements.ElementAt(1).SchemaElementKind, "Invalid schema element kind");

            IEdmEntityType entityTypeElement1 = (IEdmEntityType)model.SchemaElements.ElementAt(0);
            Assert.AreEqual("TestModel.DuplicateEntityType", entityTypeElement1.FullName(), "Invalid entity type full name");
            Assert.AreEqual("DuplicateEntityType", entityTypeElement1.Name, "Invalid entity type name");
            Assert.IsTrue(entityTypeElement1.Properties().Count() == 1, "Invalid property count");
            Assert.AreEqual("Id", entityTypeElement1.Properties().Single().Name, "Invalid property name");
            Assert.IsTrue(entityTypeElement1.DeclaredKey.Count() == 1, "Invalid declare key count for entity type");

            IEdmEntityType entityTypeElement2 = (IEdmEntityType)model.SchemaElements.ElementAt(1);
            Assert.AreEqual("TestModel.DuplicateEntityType", entityTypeElement2.FullName(), "Invalid entity type full name");
            Assert.AreEqual("DuplicateEntityType", entityTypeElement2.Name, "Invalid entity type name");
            Assert.IsTrue(entityTypeElement2.Properties().Count() == 1, "Invalid property count");
            Assert.AreEqual("Id", entityTypeElement2.Properties().Single().Name, "Invalid property name");
            Assert.IsTrue(entityTypeElement2.DeclaredKey.Count() == 1, "Invalid declare key count for entity type");

            var expectedErrors = new EdmLibTestErrors()
            {
                { 5, 10, EdmErrorCode.DuplicateEntityContainerMemberName },
                { 13, 6, EdmErrorCode.AlreadyDefined },
                { 4, 10, EdmErrorCode.BadUnresolvedEntityType },
                { 5, 10, EdmErrorCode.BadUnresolvedEntityType }
            };

            IEnumerable<EdmError> actualErrors = null;
            model.Validate(out actualErrors);
            this.CompareErrors(actualErrors, expectedErrors);
        }
コード例 #47
0
        public void ValueAnnotation_TypeExactMatch()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationPropertyTypeExactMatchCsdl(), expectedErrors);
        }
コード例 #48
0
ファイル: ParserTests.cs プロジェクト: AlineGuan/odata.net
        public void ParserTestComplexTypeWithDuplicateProperties()
        {
            var csdls = ODataTestModelBuilder.InvalidCsdl.ComplexTypeWithDuplicateProperties;
            var model = this.GetParserResult(csdls);

            IEdmEntityContainer entityContainer = model.EntityContainer;
            Assert.AreEqual("DefaultContainer", entityContainer.Name, "Invalid entity container name");
            Assert.IsTrue(entityContainer.Elements.Count() == 0, "Entity container has invalid amount of elements");

            Assert.IsTrue(model.SchemaElements.Count() == 2, "Invalid schema element count");
            Assert.AreEqual(EdmSchemaElementKind.TypeDefinition, model.SchemaElements.ElementAt(0).SchemaElementKind, "Invalid schema element kind");

            IEdmComplexType complexTypeElement = (IEdmComplexType)model.SchemaElements.ElementAt(0);
            Assert.AreEqual("TestModel.DuplicatePropertiesComplexType", complexTypeElement.FullName(), "Invalid complex type full name");
            Assert.AreEqual("DuplicatePropertiesComplexType", complexTypeElement.Name, "Invalid complex type name");

            Assert.IsTrue(complexTypeElement.DeclaredProperties.Count() == 2, "Invalid complex type property count");
            Assert.AreEqual(EdmPropertyKind.Structural, complexTypeElement.DeclaredProperties.ElementAt(0).PropertyKind, "Invalid property kind");
            Assert.AreEqual(EdmPropertyKind.Structural, complexTypeElement.DeclaredProperties.ElementAt(1).PropertyKind, "Invalid property kind");

            IEdmProperty complexProperty1 = (IEdmProperty)complexTypeElement.DeclaredProperties.ElementAt(0);
            Assert.AreEqual("Duplicate", complexProperty1.Name, "Invalid property name");

            IEdmProperty complexProperty2 = (IEdmProperty)complexTypeElement.DeclaredProperties.ElementAt(1);
            Assert.AreEqual("Duplicate", complexProperty2.Name, "Invalid property name");

            var expectedErrors = new EdmLibTestErrors()
            {
                { 6, 10, EdmErrorCode.AlreadyDefined }
            };

            IEnumerable<EdmError> actualErrors = null;
            model.Validate(out actualErrors);
            this.CompareErrors(actualErrors, expectedErrors);
        }
コード例 #49
0
        public void InlineLabeledElements()
        {
            const string annotatingModelCsdl =
                @"<Schema Namespace=""foo"" xmlns=""http://docs.oasis-open.org/odata/ns/edm"">
  <Term Name=""Term"" Type=""Edm.Int32"" >
    <Annotation Term=""foo.Term"">
      <LabeledElement Name=""Exp1"" >
        <Int>1</Int>
      </LabeledElement>
    </Annotation>
  </Term>
  <Term Name=""CollectionTerm"" Type=""Collection(Edm.Int32)"">
    <Annotation Term=""foo.CollectionTerm"">
      <Collection>
        <LabeledElementReference Name=""Exp1"" />
        <LabeledElementReference Name=""Exp2"" />
        <LabeledElementReference Name=""Exp3"" />
        <LabeledElementReference Name=""Exp4"" />
        <LabeledElementReference Name=""Exp5"" />
        <LabeledElementReference Name=""Exp6"" />
        <LabeledElementReference Name=""Exp7"" />
        <LabeledElementReference Name=""Exp8"" />
      </Collection>
    </Annotation>
  </Term>
  <Term Name=""EntityTerm"" Type=""foo.Entity"" />
  <EntityType Name=""Entity"" >
    <Key>
      <PropertyRef Name=""ID"" />
    </Key>
    <Property Name=""ID"" Type=""Edm.Int32"" Nullable=""False"" >
      <Annotation Term=""foo.EntityTerm"">
        <Record>
          <PropertyValue Property=""ID"">
            <LabeledElement Name=""Exp2"" >
              <Int>2</Int>
            </LabeledElement>
          </PropertyValue>
        </Record>
      </Annotation>
    </Property>
    <Annotation Term=""foo.Term"">
      <LabeledElement Name=""Exp3"" >
        <Int>3</Int>
      </LabeledElement>
    </Annotation>
  </EntityType>
  <Action Name=""FunctionImport"">
    <Parameter Name=""Parameter"" Type=""Edm.String"">
      <Annotation Term=""foo.Term"">
        <LabeledElement Name=""Exp4"" >
          <Int>4</Int>
        </LabeledElement>
      </Annotation>
    </Parameter>
    <ReturnType Type=""Edm.Int32"" />
    <Annotation Term=""foo.Term"">
      <LabeledElement Name=""Exp5"" >
        <Int>5</Int>
      </LabeledElement>
    </Annotation>
  </Action>
  <EntityContainer Name=""Container"">
    <EntitySet Name=""Set"" EntityType=""foo.Entity"">
      <Annotation Term=""foo.Term"">
        <LabeledElement Name=""Exp6"" >
          <Int>6</Int>
        </LabeledElement>
      </Annotation>
    </EntitySet>
    <ActionImport Name=""FunctionImport"" Action=""foo.FunctionImport"">
      <Annotation Term=""foo.Term"">
        <LabeledElement Name=""Exp7"" >
          <Int>8</Int>
        </LabeledElement>
      </Annotation>
    </ActionImport>
    <Annotation Term=""foo.Term"">
      <If>
        <LabeledElement Name=""Condition"">
          <IsType Type=""Int32"">
            <LabeledElement Name=""IsTypeOperand"">
              <Path>Id</Path>
            </LabeledElement>
          </IsType>
        </LabeledElement>
        <LabeledElement Name=""Exp8"">
          <Int>100</Int>
        </LabeledElement>
        <LabeledElement Name=""IfFalse"">
          <Int>200</Int>
        </LabeledElement>
      </If>
    </Annotation>
  </EntityContainer>
</Schema>";

            IEnumerable <EdmError> errors;
            IEdmModel model;
            bool      parsed = SchemaReader.TryParse(new XmlReader[] { XmlReader.Create(new StringReader(annotatingModelCsdl)) }, out model, out errors);

            Assert.IsTrue(parsed, "parsed");
            Assert.IsTrue(errors.Count() == 0, "No errors");

            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(model, EdmVersion.V40, expectedErrors);
        }
コード例 #50
0
        private void EdmxRoundTripCheck(string expectedEdmx, EdmxTarget target, IEdmModel model)
        {
            var errors = new EdmLibTestErrors();
            this.VerifySemanticValidation(model, Microsoft.Test.OData.Utils.Metadata.EdmVersion.V40, errors);

            string actualEdmx = GetEdmx(model, target);
            var valid = XElement.DeepEquals(XElement.Parse(expectedEdmx), XElement.Parse(actualEdmx));
            Assert.IsTrue(valid, "Invalid actual edmx.");
        }
コード例 #51
0
        public void ValidateNavigationSinglePrincipalWithMixNullableDependentCsdl()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(NavigationTestModelBuilder.NavigationSinglePrincipalWithMixNullableDependentCsdl(), EdmVersion.V40, expectedErrors);
        }
コード例 #52
0
        public void ValueAnnotation_TypeStructure_NullablePropertyWithNullExpression()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationNullablePropertyWithNullExpressionCsdl(), expectedErrors);
        }
コード例 #53
0
        public void ValueAnnotation_TypeStructure_Nested()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationNestedCsdl(), expectedErrors);
        }
コード例 #54
0
        public void ValidateValueTermWithAnnotationTarget()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueTermWithAnnotationTargetCsdl(), EdmVersion.V40, expectedErrors);
        }
コード例 #55
0
 public void ValidateValidDecimalTypeScaleValue()
 {
     var expectedErrors = new EdmLibTestErrors()
     {
         {10, 6, EdmErrorCode.ScaleOutOfRange },
         {11, 6, EdmErrorCode.ScaleOutOfRange },
     };
     this.VerifySemanticValidation(ValidationTestModelBuilder.ValidDecimalTypeScaleValue(this.EdmVersion), expectedErrors);
 }
コード例 #56
0
 public void ValidateTypeRefTypeIntegrity()
 {
     var expectedErrors = new EdmLibTestErrors() 
     {
         {30, 18, EdmErrorCode.BadUnresolvedType },
     };
     this.VerifySemanticValidation(ValidationTestModelBuilder.TypeRefTypeIntegrity(this.EdmVersion), expectedErrors);
 }
コード例 #57
0
        public void ValueAnnotation_TypeConvertible()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationTypeConvertibleCsdl(), expectedErrors);
        }
コード例 #58
0
 public void ValidateTypeReferenceInaccessibleEntityType()
 {
     var expectedErrors = new EdmLibTestErrors() 
     {
         {null, null, EdmErrorCode.BadUnresolvedType }
     };
     this.VerifySemanticValidation(ValidationTestModelBuilder.TypeReferenceInaccessibleEntityType(), expectedErrors);
 }
コード例 #59
0
        public void SimpleValueAnnotation()
        {
            var expectedErrors = new EdmLibTestErrors();

            this.VerifySemanticValidation(VocabularyTestModelBuilder.SimpleValueAnnotationCsdl(), expectedErrors);
        }