public JsonLightInstanceAnnotationWriterTests()
        {
            this.jsonWriter = new MockJsonWriter
            {
                WriteNameVerifier  = name => { },
                WriteValueVerifier = str => { }
            };

            this.referencedModel = new EdmModel();
            model = TestUtils.WrapReferencedModelsToMainModel(referencedModel);

            // Version will be V3+ in production since it's JSON Light only
            this.valueWriter = new MockJsonLightValueSerializer(jsonWriter, model)
            {
                Settings = new ODataMessageWriterSettings {
                    Version = ODataVersion.V4, ShouldIncludeAnnotation = ODataUtils.CreateAnnotationFilter("*")
                }
            };
            this.jsonLightInstanceAnnotationWriter = new JsonLightInstanceAnnotationWriter(this.valueWriter, new JsonMinimalMetadataTypeNameOracle());
        }
        public void TestWriteInstanceAnnotationsForError()
        {
            var defaultValueWriter = new MockJsonLightValueSerializer(jsonWriter, model)
            {
                Settings = new ODataMessageWriterSettings {
                    Version = ODataVersion.V4
                }
            };
            var defaultAnnotationWriter = new JsonLightInstanceAnnotationWriter(defaultValueWriter, new JsonMinimalMetadataTypeNameOracle());

            var annotations = new Collection <ODataInstanceAnnotation>();

            annotations.Add(new ODataInstanceAnnotation("term.one", new ODataPrimitiveValue(123)));
            annotations.Add(new ODataInstanceAnnotation("term.two", new ODataPrimitiveValue("456")));
            var verifierCalls = 0;

            this.jsonWriter.WriteNameVerifier         = (name) => verifierCalls++;
            defaultValueWriter.WritePrimitiveVerifier = (value, reference) => verifierCalls++;

            defaultAnnotationWriter.WriteInstanceAnnotationsForError(annotations);
            verifierCalls.Should().Be(4);
        }