private void AssertDuplicateMetadataReferencePropertyFails(DuplicatePropertyNamesChecker duplicatePropertyNamesChecker)
        {
            string payload = "{\"#action\":42, \"#action\":43}";

            using (ODataJsonLightInputContext inputContext = this.CreateJsonLightInputContext(payload))
            {
                ODataJsonLightDeserializer deserializer = new ODataJsonLightPropertyAndValueDeserializer(inputContext);
                AdvanceReaderToFirstProperty(deserializer.JsonReader);

                deserializer.ProcessProperty(
                    duplicatePropertyNamesChecker,
                    (propertyName) => null,
                    (propertyParsingResult, propertyName) =>
                    {
                        propertyParsingResult.Should().Be(ODataJsonLightDeserializer.PropertyParsingResult.MetadataReferenceProperty, "parsing JSON object '{0}'", payload);
                        propertyName.Should().Be("#action", "reported name is wrong for JSON object '{0}'", payload);

                        deserializer.JsonReader.Should().BeOn(JsonNodeType.PrimitiveValue, 42);

                        deserializer.JsonReader.Read();
                        deserializer.JsonReader.NodeType.Should().Be(JsonNodeType.Property);
                    });

                Action readDuplicateProperty = () => deserializer.ProcessProperty(
                    duplicatePropertyNamesChecker,
                    (propertyName) => null,
                    (propertyParsingResult, propertyName) => { });

                readDuplicateProperty.ShouldThrow<ODataException>("two metadata reference properties were encountered with the same name").WithMessage(ErrorStrings.DuplicatePropertyNamesChecker_DuplicatePropertyNamesNotAllowed("#action"));
            }
        }
        private void RunPropertyParsingTest(
            string jsonInput,
            ODataJsonLightDeserializer.PropertyParsingResult expectedPropertyParsingResult,
            string expectedName,
            Action<JsonReader, DuplicatePropertyNamesChecker> additionalVerification = null,
            Func<JsonReader, string, object> readPropertyAnnotationValue = null,
            DuplicatePropertyNamesChecker duplicatePropertyNamesChecker = null)
        {
            if (duplicatePropertyNamesChecker == null)
            {
                duplicatePropertyNamesChecker = new DuplicatePropertyNamesChecker(false, true);
            }
            if (readPropertyAnnotationValue == null)
            {
                readPropertyAnnotationValue = (jsonReader, annotationName) => jsonReader.ReadPrimitiveValue();
            }

            using (ODataJsonLightInputContext inputContext = this.CreateJsonLightInputContext(jsonInput))
            {
                ODataJsonLightDeserializer deserializer = new ODataJsonLightPropertyAndValueDeserializer(inputContext);
                AdvanceReaderToFirstProperty(deserializer.JsonReader);

                deserializer.ProcessProperty(
                    duplicatePropertyNamesChecker,
                    (propertyName) => readPropertyAnnotationValue(deserializer.JsonReader, propertyName),
                    (propertyParsingResult, propertyName) =>
                    {
                        propertyParsingResult.Should().Be(expectedPropertyParsingResult, "parsing JSON object '{0}'", jsonInput);
                        propertyName.Should().Be(expectedName, "reported name is wrong for JSON object '{0}'", jsonInput);
                        if (additionalVerification != null)
                        {
                            additionalVerification(deserializer.JsonReader, duplicatePropertyNamesChecker);
                        }
                    });
            }
        }