public void ExceptionThrowForInvalidPropertyPath() { EdmModel model = new EdmModel(); EdmEntityType personType = new EdmEntityType("MyNs", "Person", null, false, false, true); personType.AddKeys(personType.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32)); personType.AddStructuralProperty("Name", EdmCoreModel.Instance.GetString(isNullable: true)); var container = new EdmEntityContainer("MyNs", "Container"); model.AddElement(personType); container.AddEntitySet("People", personType); model.AddElement(container); IEdmEntitySet peopleSet = model.FindDeclaredEntitySet("People"); IEdmPathExpression nameExpression = new EdmPropertyPathExpression("NameName"); IEdmCollectionExpression collection = new EdmCollectionExpression(new[] { nameExpression }); IEdmValueTerm term = null; foreach (var referencedModel in model.ReferencedModels) { term = referencedModel.FindDeclaredValueTerm("Org.OData.Core.V1.OptimisticConcurrencyControl"); if (term != null) { break; } } Assert.NotNull(term); EdmAnnotation valueAnnotationOnEntitySet = new EdmAnnotation(peopleSet, term, collection); valueAnnotationOnEntitySet.SetSerializationLocation(model, EdmVocabularyAnnotationSerializationLocation.Inline); model.AddVocabularyAnnotation(valueAnnotationOnEntitySet); ODataEntry entry = new ODataEntry { Properties = new[] { new ODataProperty { Name = "ID", Value = 123 }, new ODataProperty { Name = "Name", Value = "lucy" }, } }; Action action = () => GetWriterOutputForContentTypeAndKnobValue(entry, model, peopleSet, personType); action.ShouldThrow <ODataException>().WithMessage(ErrorStrings.EdmValueUtils_PropertyDoesntExist("MyNs.Person", "NameName")); }