public void WriteInstanceAnnotationWithNullValueShouldThrowIfTheTermIsNotNullableInTheModel() { // Add a value term of type Collection(Edm.String) to the model. this.referencedModel.AddElement(new EdmTerm( "My.Namespace", "NotNullable", EdmCoreModel.Instance.GetInt32(isNullable: false))); string term = "My.Namespace.NotNullable"; Action action = () => this.jsonLightInstanceAnnotationWriter.WriteInstanceAnnotation(new ODataInstanceAnnotation(term, new ODataNullValue())); action.ShouldThrow <ODataException>().WithMessage(ODataErrorStrings.ODataAtomPropertyAndValueSerializer_NullValueNotAllowedForInstanceAnnotation(term, "Edm.Int32")); }