示例#1
0
        public void SerializeAnnotationWithInvalidTermModel()
        {
            IEnumerable <EdmError> actualErrors;
            var expectedErrors = new EdmLibTestErrors();

            GetSerializerResult(VocabularyTestModelBuilder.AnnotationWithInvalidTermModel(), out actualErrors);
            CompareErrors(actualErrors, expectedErrors);
        }
        public void ValidateAnnotationWithInvalidTerm()
        {
            EdmModel model = VocabularyTestModelBuilder.AnnotationWithInvalidTermModel();

            Assert.AreEqual(1, model.VocabularyAnnotations.Count(), "Invalid count of annotation.");

            var expectedErrors = new EdmLibTestErrors()
            {
                { "(Microsoft.OData.Edm.Library.Annotations.EdmAnnotation)", EdmErrorCode.BadUnresolvedTerm }
            };

            IEnumerable <EdmError> actualErrors = null;
            var validationResult = model.Validate(Microsoft.OData.Edm.Library.EdmConstants.EdmVersionLatest, out actualErrors);

            Assert.IsTrue(actualErrors.Any() ? !validationResult : validationResult, "The return value of the Validate method does not match the reported validation errors.");
            this.CompareErrors(actualErrors, expectedErrors);
        }