Example #1
0
        /// <summary>
        /// Creates a new <see cref="ReorderingJsonReader"/> and advances it to the first property node
        /// </summary>
        /// <param name="json">The json string to potentially reorder and read.</param>
        /// <returns>The created json reader.</returns>
        private static ReorderingJsonReader CreateReorderingReaderPositionedOnFirstProperty(string json)
        {
            var reader = new ReorderingJsonReader(new StringReader(json), maxInnerErrorDepth: 0, isIeee754Comaptible: true);

            reader.NodeType.Should().Be(JsonNodeType.None);
            reader.Read();
            reader.NodeType.Should().Be(JsonNodeType.StartObject);
            reader.Read();
            reader.NodeType.Should().Be(JsonNodeType.Property);
            return(reader);
        }
        /// <summary>
        /// Creates a new <see cref="ReorderingJsonReader"/> and advances it to the first property node
        /// </summary>
        /// <param name="json">The json string to potentially reorder and read.</param>
        /// <returns>The created json reader.</returns>
        private static ReorderingJsonReader CreateReorderingReaderPositionedOnFirstProperty(string json)
        {
            var stringReader = new StringReader(json);
            var innerReader  = new JsonReader(stringReader, isIeee754Compatible: true);
            var reader       = new ReorderingJsonReader(innerReader, maxInnerErrorDepth: 0);

            Assert.Equal(JsonNodeType.None, reader.NodeType);
            reader.Read();
            Assert.Equal(JsonNodeType.StartObject, reader.NodeType);
            reader.Read();
            Assert.Equal(JsonNodeType.Property, reader.NodeType);
            return(reader);
        }