/// <summary>
        /// Initializes a new instance of the <see cref="JsonPointer"/> class with the
        /// specified string.
        /// </summary>
        /// <param name="value">
        /// The string value of the JSON Pointer.
        /// </param>
        /// <param name="representation">
        /// A value that specifies the representation of the JON Pointer.
        /// </param>
        public JsonPointer(
            string value,
            JsonPointerRepresentation representation = JsonPointerRepresentation.Normal)
        {
            _value          = value;
            _representation = representation;

            ReferenceTokens = ImmutableArray.CreateRange(Parse(value));
        }
Exemple #2
0
        private void RunTestCase(ParsingTestCase test, JsonPointerRepresentation format)
        {
            JsonPointer jPointer = null;

            Action action = () => jPointer = new JsonPointer(test.Value, format);

            if (test.Valid)
            {
                action.Should().NotThrow();
                jPointer.ReferenceTokens.Should().ContainInOrder(test.ReferenceTokens);
                jPointer.ReferenceTokens.Length.Should().Be(test.ReferenceTokens.Length);
            }
            else
            {
                action.Should().Throw <ArgumentException>();
            }
        }