public void XElementAnnotationTestNavigationPropertyWithAnnotationModel() { XElement expectedAnnotation = new XElement("{http://foo}Annotation", 1); AnnotationInfo annotationInfo = new AnnotationInfo() { Namespace = "http://foo", Name = "Annotation" }; List <ElementInfo> annotationPath = new List <ElementInfo>() { new ElementInfo() { Name = "Person", Type = AnnotatableElementType.EntityType }, new ElementInfo() { Name = "Friends", Type = AnnotatableElementType.NavigationProperty } }; ElementLocation annotationLocation = new ElementLocation() { Namespace = "DefaultNamespace", ElementPath = annotationPath }; this.AnnotationRoundTripCsdlCheck(XElementAnnotationModelBuilder.NavigationPropertyWithAnnotationCsdl(), expectedAnnotation, annotationInfo, annotationLocation, XElementAnnotationModelBuilder.NavigationPropertyWithAnnotationModel()); }
public void XElementAnnotationTestFunctionImportParameterWithAnnotationModel() { XElement expectedAnnotation = new XElement("{http://foo}Annotation", 1); AnnotationInfo annotationInfo = new AnnotationInfo() { Namespace = "http://foo", Name = "Annotation" }; List <ElementInfo> annotationPath = new List <ElementInfo>() { new ElementInfo() { Name = "SimpleFunction", Type = AnnotatableElementType.Function }, new ElementInfo() { Name = "Name", Type = AnnotatableElementType.Parameter }, }; ElementLocation annotationLocation = new ElementLocation() { Namespace = "Default", ElementPath = annotationPath }; this.AnnotationRoundTripCsdlCheck(XElementAnnotationModelBuilder.ActionImportParameterWithAnnotationCsdl(), expectedAnnotation, annotationInfo, annotationLocation, XElementAnnotationModelBuilder.OperationImportParameterWithAnnotationModel()); }
public void XElementAnnotationTestDifferentAnnotationNamespaceModel() { XElement expectedAnnotation = new XElement("{http://foo}Annotation", new XElement("{http://foo1}Child", new XElement("{http://foo2}GrandChild", "1" ) ) ); AnnotationInfo annotationInfo = new AnnotationInfo() { Namespace = "http://foo", Name = "Annotation" }; List <ElementInfo> annotationPath = new List <ElementInfo>() { new ElementInfo() { Name = "Container", Type = AnnotatableElementType.EntityContainer }, new ElementInfo() { Name = "SimpleSet", Type = AnnotatableElementType.EntitySet } }; ElementLocation annotationLocation = new ElementLocation() { Namespace = "DefaultNamespace", ElementPath = annotationPath }; this.AnnotationRoundTripCsdlCheck(XElementAnnotationModelBuilder.DifferentAnnotationNamespaceCsdl(), expectedAnnotation, annotationInfo, annotationLocation, XElementAnnotationModelBuilder.DifferentAnnotationNamespaceModel()); }
public void XElementAnnotationTestAnnotationWithEntitySetTagInEntityContainerModel() { XElement expectedAnnotation = new XElement("{http://foo}EntitySet", "1" ); AnnotationInfo annotationInfo = new AnnotationInfo() { Namespace = "http://foo", Name = "EntitySet" }; List <ElementInfo> annotationPath = new List <ElementInfo>() { new ElementInfo() { Name = "Container", Type = AnnotatableElementType.EntityContainer } }; ElementLocation annotationLocation = new ElementLocation() { Namespace = "DefaultNamespace", ElementPath = annotationPath }; this.AnnotationRoundTripCsdlCheck(XElementAnnotationModelBuilder.AnnotationWithEntitySetTagInEntityContainerCsdl(), expectedAnnotation, annotationInfo, annotationLocation, XElementAnnotationModelBuilder.AnnotationWithEntitySetTagInEntityContainerModel()); }
public void XElementAnnotationTestAnnotationWithSchemaTagValueModel() { XElement expectedAnnotation = new XElement("{http://foo}Annotation", "</Schema>" ); AnnotationInfo annotationInfo = new AnnotationInfo() { Namespace = "http://foo", Name = "Annotation" }; List <ElementInfo> annotationPath = new List <ElementInfo>() { new ElementInfo() { Name = "SimpleType", Type = AnnotatableElementType.EntityType } }; ElementLocation annotationLocation = new ElementLocation() { Namespace = "DefaultNamespace", ElementPath = annotationPath }; this.AnnotationRoundTripCsdlCheck(XElementAnnotationModelBuilder.AnnotationWithSchemaTagValueCsdl(), expectedAnnotation, annotationInfo, annotationLocation, XElementAnnotationModelBuilder.AnnotationWithSchemaTagValueModel()); }
public void XElementAnnotationTestAnnotationWithValueCsdl() { XElement expectedAnnotation = new XElement("{http://foo}Annotation", "Value 1.0" ); AnnotationInfo annotationInfo = new AnnotationInfo() { Namespace = "http://foo", Name = "Annotation" }; List <ElementInfo> annotationPath = new List <ElementInfo>() { new ElementInfo() { Name = "SimpleFunction", Type = AnnotatableElementType.Function }, new ElementInfo() { Name = "Id", Type = AnnotatableElementType.Parameter } }; ElementLocation annotationLocation = new ElementLocation() { Namespace = "DefaultNamespace", ElementPath = annotationPath }; this.AnnotationRoundTripCsdlCheck(XElementAnnotationModelBuilder.AnnotationWithValueCsdl(), expectedAnnotation, annotationInfo, annotationLocation); }
public void XElementAnnotationTestSetChildAnnotationAsAnnotationModel() { var model = XElementAnnotationModelBuilder.SetChildAnnotationAsAnnotationModel(); var errors = new EdmLibTestErrors { { null, null, EdmErrorCode.InvalidElementAnnotation } }; this.VerifySemanticValidation(model, EdmVersion.V40, errors); }
public void XElementAnnotationTestComplexNamespaceOverlappingModel() { XElement expectedAnnotation = new XElement("{http://foo}Annotation", new XElement("{http://foo}Child", new XElement("{http://foo1}GrandChild", new XElement("{http://foo}GreatGrandChild", "1" ) ) ), new XElement("{http://foo1}Child", new XElement("{http://foo}GrandChild", "1" ) ) ); AnnotationInfo annotationInfo = new AnnotationInfo() { Namespace = "http://foo", Name = "Annotation" }; List <ElementInfo> annotationPath = new List <ElementInfo>() { new ElementInfo() { Name = "Container", Type = AnnotatableElementType.EntityContainer }, new ElementInfo() { Name = "SimpleFunction", Type = AnnotatableElementType.FunctionImport } }; ElementLocation annotationLocation = new ElementLocation() { Namespace = "Default", ElementPath = annotationPath }; this.AnnotationRoundTripCsdlCheck(XElementAnnotationModelBuilder.ComplexNamespaceOverlappingCsdl(), expectedAnnotation, annotationInfo, annotationLocation, XElementAnnotationModelBuilder.ComplexNamespaceOverlappingModel()); }
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); }
public void XElementAnnotationTestNestedXElementWithNoValueCsdl() { XElement expectedAnnotation = new XElement("{http://foo}Annotation", new XElement("{http://foo}Child", new XElement("{http://foo}GrandChild", new XElement("{http://foo}GreatGrandChild", new XElement("{http://foo}GreateGreatGrandChild") ) ) ) ); AnnotationInfo annotationInfo = new AnnotationInfo() { Namespace = "http://foo", Name = "Annotation" }; List <ElementInfo> annotationPath = new List <ElementInfo>() { new ElementInfo() { Name = "SimpleType", Type = AnnotatableElementType.ComplexType }, new ElementInfo() { Name = "Id", Type = AnnotatableElementType.Property } }; ElementLocation annotationLocation = new ElementLocation() { Namespace = "DefaultNamespace", ElementPath = annotationPath }; this.AnnotationRoundTripCsdlCheck(XElementAnnotationModelBuilder.NestedXElementWithNoValueCsdl(), expectedAnnotation, annotationInfo, annotationLocation); }
public void XElementAnnotationTestEnumWithAnnotationCsdl() { XElement expectedAnnotation = new XElement("{http://foo}Annotation", 1); AnnotationInfo annotationInfo = new AnnotationInfo() { Namespace = "http://foo", Name = "Annotation" }; List <ElementInfo> annotationPath = new List <ElementInfo>() { new ElementInfo() { Name = "Spicy", Type = AnnotatableElementType.Enum } }; ElementLocation annotationLocation = new ElementLocation() { Namespace = "DefaultNamespace", ElementPath = annotationPath }; this.AnnotationRoundTripCsdlCheck(XElementAnnotationModelBuilder.EnumWithAnnotationCsdl(), expectedAnnotation, annotationInfo, annotationLocation); }
public void XElementAnnotationTestAnnotationWithoutChildrenModel() { XElement expectedAnnotation = new XElement("{http://foo}Annotation"); AnnotationInfo annotationInfo = new AnnotationInfo() { Namespace = "http://foo", Name = "Annotation" }; List <ElementInfo> annotationPath = new List <ElementInfo>() { new ElementInfo() { Name = "ComplexType", Type = AnnotatableElementType.ComplexType } }; ElementLocation annotationLocation = new ElementLocation() { Namespace = "DefaultNamespace", ElementPath = annotationPath }; this.AnnotationRoundTripCsdlCheck(XElementAnnotationModelBuilder.AnnotationWithoutChildrenCsdl(), expectedAnnotation, annotationInfo, annotationLocation, XElementAnnotationModelBuilder.AnnotationWithoutChildrenModel()); }