public void SerializeInlineAnnotationWithInvalidTargetModel() { var actualCsdl = ConvertCsdlsToXElements(@"<Schema Namespace=""Foo"" xmlns=""http://docs.oasis-open.org/odata/ns/edm""> <ComplexType Name=""SimpleType""> <Property Name=""StringValue"" Nullable=""true"" Type=""Edm.String"" /> </ComplexType> <EntityType Name=""SimpleEntity""> <Key> <PropertyRef Name=""Int32Value"" /> </Key> <Property Name=""Int32Value"" Nullable=""false"" Type=""Edm.Int32"" /> </EntityType> <Function Name=""InvalidFunction""> <Parameter Name=""InvalidParameter"" Nullable=""true"" Type=""Edm.Int32""> <Annotation Int=""1"" Term=""Foo.SimpleTerm"" /> </Parameter> <ReturnType Type=""Edm.Int32"" /> <Annotation Int=""1"" Term=""Foo.SimpleTerm"" /> </Function> <Term Name=""ComplexTerm"" Type=""Foo.SimpleType"" /> <Term Name=""SimpleTerm"" Type=""Edm.Int32"" /> <Term Name=""EntityTerm"" Type=""Foo.SimpleEntity"" /> </Schema>"); SerializingValidator(VocabularyTestModelBuilder.AnnotationWithInvalidTargetModel(EdmVocabularyAnnotationSerializationLocation.Inline), actualCsdl); }
public void SerializeVocabularyAnnotationBadValueCsdl() { var actualCsdl = ConvertCsdlsToXElements(@" <Schema Namespace=""My.NS1"" Alias=""Self"" xmlns=""http://docs.oasis-open.org/odata/ns/edm""> <Term Name=""SByteValue"" Type=""SByte"" /> <Term Name=""ByteValue"" Type=""Byte"" /> <Term Name=""Int64Value"" Type=""Int64"" /> <Term Name=""DoubleValue"" Type=""Double"" /> <Term Name=""DateTimeValue"" Type=""DateTimeOffset"" /> <Term Name=""GuidValue"" Type=""Guid"" /> <ComplexType Name=""Address""> <Property Name=""Id"" Type=""Int64"" Nullable=""false""/> </ComplexType> <Annotations Target=""Self.Address""> <Annotation Term=""My.NS1.SByteValue"" Int=""-129"" /> <Annotation Term=""My.NS1.ByteValue"" Int=""256"" /> <Annotation Term=""My.NS1.Int64Value"" Int=""0"" /> <Annotation Term=""My.NS1.DoubleValue"" Float=""0"" /> <Annotation Term=""My.NS1.DateTimeValue"" DateTimeOffset=""0001-01-01T00:00:00Z"" /> <Annotation Term=""My.NS1.GuidValue"" Guid=""00000000-0000-0000-0000-000000000000"" /> </Annotations> </Schema>"); SerializingValidator(VocabularyTestModelBuilder.VocabularyAnnotationBadValueCsdl(), actualCsdl); }
public void SerializeSimpleVocabularyAnnotationModel() { var actualCsdl = ConvertCsdlsToXElements(@" <Schema Namespace=""Foo"" Alias=""Self"" xmlns=""http://docs.oasis-open.org/odata/ns/edm""> <ComplexType Name=""SimpleType""> <Property Name=""StringValue"" Type=""Edm.String"" Nullable=""true""/> </ComplexType> <EntityType Name=""SimpleEntity""> <Key> <PropertyRef Name=""Int32Value"" /> </Key> <Property Name=""Int32Value"" Type=""Edm.Int32"" Nullable=""false""/> </EntityType> <Term Name=""SimpleTerm"" Type=""Edm.Int32""> <Annotation Int=""1"" Term=""Foo.SimpleTerm"" /> </Term> <Term Name=""ComplexTerm"" Type=""Foo.SimpleType"" /> <Annotations Target=""Foo.ComplexTerm""> <Annotation Int=""2"" Term=""Foo.SimpleTerm"" /> </Annotations> <Term Name=""EntityTerm"" Type=""Foo.SimpleEntity"" /> </Schema>"); SerializingValidator(VocabularyTestModelBuilder.SimpleVocabularyAnnotationModel(), actualCsdl); }
public void VocabularyAnnotation_Path_NotValid() { var expectedErrors = new EdmLibTestErrors(); // No error is expected, since this behaviour is by design this.VerifySemanticValidation(VocabularyTestModelBuilder.VocabularyAnnotationPathNotValidCsdl(), expectedErrors); }
public void RoundTripValueAnnotationWithCollectionComplexTypeCsdl() { var expectedErrors = new EdmLibTestErrors(); this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationWithCollectionComplexTypeCsdl(), EdmVersion.V40, expectedErrors); this.RoundTripValidator(VocabularyTestModelBuilder.ValueAnnotationWithCollectionComplexTypeCsdl(), EdmVersion.V40); }
public void SerializeAnnotationWithInvalidTermModel() { IEnumerable <EdmError> actualErrors; var expectedErrors = new EdmLibTestErrors(); GetSerializerResult(VocabularyTestModelBuilder.AnnotationWithInvalidTermModel(), out actualErrors); CompareErrors(actualErrors, expectedErrors); }
public void ValidateDefaultAnnotation() { EdmModel model = VocabularyTestModelBuilder.SimpleModel(); var valueAnnotation = new MutableValueAnnotation(); this.VerifyThrowsException(typeof(InvalidOperationException), () => model.AddVocabularyAnnotation(valueAnnotation)); }
public void ValueAnnotation_If_TypeNotMatch() { var expectedErrors = new EdmLibTestErrors() { { 13, 10, EdmErrorCode.ExpressionPrimitiveKindNotValidForAssertedType }, }; this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationIfTypeNotMatchCsdl(), expectedErrors); }
public void ValueAnnotation_TypeStructure_PropertyNameNotMatch() { var expectedErrors = new EdmLibTestErrors() { { 9, 10, EdmErrorCode.RecordExpressionHasExtraProperties } }; this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationPropertyNameNotMatchCsdl(), expectedErrors); }
public void VocabularyAnnotation_TargetNotResolvable() { var expectedErrors = new EdmLibTestErrors() { { 8, 6, EdmErrorCode.BadUnresolvedType }, }; this.VerifySemanticValidation(VocabularyTestModelBuilder.VocabularyAnnotationTargetNotResolvableCsdl(), expectedErrors); }
public void Term_TypeNotResolvable() { var expectedErrors = new EdmLibTestErrors() { { 3, 4, EdmErrorCode.BadUnresolvedType }, }; this.VerifySemanticValidation(VocabularyTestModelBuilder.TermTypeNotResolvableCsdl(), expectedErrors); }
public void ValidateVocabularyWithIncorrectType() { var expectedErrors = new EdmLibTestErrors() { { null, null, EdmErrorCode.ExpressionNotValidForTheAssertedType } }; this.VerifySemanticValidation(VocabularyTestModelBuilder.StructuredVocabularyAnnotation(), this.EdmVersion, expectedErrors); }
public void ValueAnnotation_FunctionApplication_TypeNotMatch() { var expectedErrors = new EdmLibTestErrors() { { 16, 9, EdmErrorCode.BadUnresolvedOperation }, }; this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationFunctionTypeNotMatchCsdl(), expectedErrors); }
public void ValueTerm_NameConflict_WithOthers() { var expectedErrors = new EdmLibTestErrors() { { 3, 4, EdmErrorCode.AlreadyDefined }, }; this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueTermNameConflictWithOthersCsdl(), expectedErrors); }
public void VocabularyAnnotation_TypeStructure_PropertyTypeNotMatch() { var expectedErrors = new EdmLibTestErrors() { { 10, 12, EdmErrorCode.ExpressionPrimitiveKindNotValidForAssertedType }, }; this.VerifySemanticValidation(VocabularyTestModelBuilder.VocabularyAnnotationPropertyTypeNotMatchCsdl(), expectedErrors); }
public void ParserAnnotationQualifiersWithNonSimpleValueCsdlSchemaCompliantTest() { var edmVersions = new EdmVersion[] { EdmVersion.V40 }; foreach (var edmVersion in edmVersions) { this.BasicXsdValidationTestForParserInputCsdl(VocabularyTestModelBuilder.AnnotationQualifiersWithNonSimpleValue(), edmVersion); } }
public void SerializerTestEnumMemberReferenceExpression() { var expectedCsdlElements = VocabularyTestModelBuilder.OutOfLineAnnotationNavigationProperty(); IEnumerable <EdmError> edmError = null; var actualCsdlElements = this.GetSerializerResult(this.GetParserResult(expectedCsdlElements), EdmLibCsdlContentGenerator.GetEdmVersion(expectedCsdlElements.First().Name.Namespace), out edmError).Select(n => XElement.Parse(n)); Assert.IsTrue(!edmError.Any(), "Unexpected serializer errors."); new SerializerResultVerifierUsingXml().Verify(expectedCsdlElements, actualCsdlElements); }
public void ParserInlineAnnotationFunctionImportParameterCsdlSchemaCompliantTest() { var edmVersions = new EdmVersion[] { EdmVersion.V40 }; foreach (var edmVersion in edmVersions) { this.BasicXsdValidationTestForParserInputCsdl(VocabularyTestModelBuilder.InlineAnnotationFunctionImportParameter(), edmVersion); } }
public void VocabularySerializingAnnotationTermsWithNoNamespace() { IEdmModel edmModel; IEnumerable <EdmError> errors; var isParsed = SchemaReader.TryParse(VocabularyTestModelBuilder.AnnotationTermsWithNoNamespace().Select(e => e.CreateReader()), out edmModel, out errors); Assert.IsFalse(isParsed, "SchemaReader.TryParse failed"); Assert.IsFalse(errors.Count() == 0, "SchemaReader.TryParse returned errors"); }
public void ParserInlineAnnotationNavigationPropertyCsdlSchemaCompliantTest() { var edmVersions = new EdmVersion[] { EdmVersion.V40 }; foreach (var edmVersion in edmVersions) { this.BasicXsdValidationTestForParserInputCsdl(VocabularyTestModelBuilder.InlineAnnotationNavigationProperty(), edmVersion); } }
public void ValueAnnotation_RecordTypeNotResolvable() { var expectedErrors = new EdmLibTestErrors() { { 9, 10, EdmErrorCode.BadUnresolvedType }, }; this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationRecordTypeNotResolvableCsdl(), expectedErrors); }
public void ValidateValueAnnotationNonNullablePropertyWithNullValueCsdl() { var expectedErrors = new EdmLibTestErrors() { { null, null, EdmErrorCode.NullCannotBeAssertedToBeANonNullableType } }; this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationNonNullablePropertyWithNullValueCsdl(), expectedErrors); }
public void ValueAnnotation_TermNotResolvable() { var expectedErrors = new EdmLibTestErrors() { // Unresolved value terms are not reported as errors. }; this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationTermNotResolvableCsdl(), expectedErrors); }
public void ParserAnnotationValueTermCsdlSchemaCompliantTest() { var edmVersions = new EdmVersion[] { EdmVersion.V40 }; foreach (var edmVersion in edmVersions) { this.BasicXsdValidationTestForParserInputCsdl(VocabularyTestModelBuilder.OutOfLineAnnotationValueTerm(), edmVersion); this.BasicXsdValidationTestForParserInputCsdl(VocabularyTestModelBuilder.InlineAnnotationValueTerm(), edmVersion); } }
public void ValueAnnotation_Ambiguous_SameTermSameQualifer() { var expectedErrors = new EdmLibTestErrors() { { 9, 6, EdmErrorCode.DuplicateAnnotation }, { 10, 6, EdmErrorCode.DuplicateAnnotation }, }; this.VerifySemanticValidation(VocabularyTestModelBuilder.ValueAnnotationAmbiguousSameTermSameQualiferCsdl(), expectedErrors); }
public void ValidateAnnotationEntityTypeWithMissingAndExtraPropertiesModel() { var expectedErrors = new EdmLibTestErrors() { { 23, 14, EdmErrorCode.RecordExpressionHasExtraProperties }, { 33, 18, EdmErrorCode.RecordExpressionHasExtraProperties } }; this.VerifySemanticValidation(VocabularyTestModelBuilder.AnnotationEntityTypeWithMissingOrExtraPropertiesCsdl(), expectedErrors); }
public void VocabularyAnnotation_IsType_TypeNotResolved() { var expectedErrors = new EdmLibTestErrors() { { 11, 10, EdmErrorCode.BadUnresolvedType }, { 15, 10, EdmErrorCode.ExpressionPrimitiveKindNotValidForAssertedType }, }; this.VerifySemanticValidation(VocabularyTestModelBuilder.VocabularyAnnotationIfTypeNotResolvedCsdl(), expectedErrors); }
public void ValidateValueAnnotationWithQualifier() { EdmModel model = VocabularyTestModelBuilder.ValueAnnotationWithQualifierModel(); Assert.AreEqual(2, model.VocabularyAnnotations.Count(), "Invalid count of annotation."); var expectedErrors = new EdmLibTestErrors(); this.VerifySemanticValidation(model, expectedErrors); }
public void VocabularyAnnotation_TypeNotMatch() { var expectedErrors = new EdmLibTestErrors() { { 9, 6, EdmErrorCode.PrimitiveConstantExpressionNotValidForNonPrimitiveType }, { 12, 10, EdmErrorCode.RecordExpressionNotValidForNonStructuredType }, }; this.VerifySemanticValidation(VocabularyTestModelBuilder.VocabularyAnnotationTypeNotMatchCsdl(), expectedErrors); }
public void VocabularyValidationDuplicateError() { var expectedErrors = new EdmLibTestErrors() { { "(EdmLibTests.StubEdm.StubEdmEntityType)", EdmErrorCode.KeyMissingOnEntityType }, { "(EdmLibTests.StubEdm.StubEdmEntityType)", EdmErrorCode.KeyMissingOnEntityType }, { "(EdmLibTests.VocabularyStubs.StubTypeTerm)", EdmErrorCode.KeyMissingOnEntityType } }; this.VerifySemanticValidation(VocabularyTestModelBuilder.StructuredValueAnnotation(), this.EdmVersion, expectedErrors); }