示例#1
0
        public void CreateEnumerablePathSegmentFromSegmentText_Expected_EnumerableJsonPathSegment()
        {
            var path    = new JsonPath();
            var segment = path.CreatePathSegment("EnumerableData()");

            const bool expected = true;
            var        actual   = segment.IsEnumarable;

            Assert.AreEqual(expected, actual);
        }
        public void ToStringOnScalarSegment_WhereEnumerablesArentConsidered__Expected_ScalarFormat()
        {
            JsonPath     path    = new JsonPath();
            IPathSegment segment = path.CreatePathSegment("Name");

            string expected = "Name";
            string actual   = segment.ToString(false);

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void CreateScalarPathSegmentFromSegmentText_Expected_ScalarJsonPathSegment()
        {
            var path    = new JsonPath();
            var segment = path.CreatePathSegment("Name");

            const bool expected = false;
            var        actual   = segment.IsEnumarable;

            Assert.AreEqual(expected, actual);
        }
        public void ToStringOnEnumerableSegment_WhereEnumerablesAreConsidered_Expected_ScalarFormat()
        {
            JsonPath     path    = new JsonPath();
            IPathSegment segment = path.CreatePathSegment("Collection()");

            string expected = "Collection()";
            string actual   = segment.ToString(true);

            Assert.AreEqual(expected, actual);
        }
        public void ToStringOnScalarSegment_Expected_ScalarFormat()
        {
            JsonPath     path    = new JsonPath();
            IPathSegment segment = path.CreatePathSegment("Name");

            string expected = "Name";
            string actual   = segment.ToString();

            Assert.AreEqual(expected, actual);
        }
示例#6
0
        public void ToStringOnEnumerableSegment_WhereEnumerablesArentConsidered_Expected_ScalarFormat()
        {
            var path    = new JsonPath();
            var segment = path.CreatePathSegment("Collection()");

            const string expected = "Collection";
            var          actual   = segment.ToString(false);

            Assert.AreEqual(expected, actual);
        }
示例#7
0
        public void ToStringOnEnumerableSegment_Expected_EnumerableFormat()
        {
            var path    = new JsonPath();
            var segment = path.CreatePathSegment("Collection()");

            const string expected = "Collection()";
            var          actual   = segment.ToString();

            Assert.AreEqual(expected, actual);
        }
示例#8
0
        public void ToStringOnScalarSegment_WhereEnumerablesAreConsidered__Expected_ScalarFormat()
        {
            var path    = new JsonPath();
            var segment = path.CreatePathSegment("Name");

            const string expected = "Name";
            var          actual   = segment.ToString(true);

            Assert.AreEqual(expected, actual);
        }
示例#9
0
        public void CreateScalarPathSegmentFromJProperty_Expected_ScalarJsonPathSegment()
        {
            var jProperty = new JProperty("ScalarProperty", "ScalarValue");
            var path      = new JsonPath();
            var segment   = path.CreatePathSegment(jProperty);

            const bool expected = false;
            var        actual   = segment.IsEnumarable;

            Assert.AreEqual(expected, actual);
        }
示例#10
0
        public void CreateEnumerablePathSegmentFromJProperty_Expected_EnumerableJsonPathSegment()
        {
            var jProperty = new JProperty("EnumerableProperty", new JArray(
                                              new JObject(new JProperty("ScalarProperty", "ScalarValue"),
                                                          new JProperty("ScalarProperty1", "ScalarValue1"))));
            var path    = new JsonPath();
            var segment = path.CreatePathSegment(jProperty);

            const bool expected = true;
            var        actual   = segment.IsEnumarable;

            Assert.AreEqual(expected, actual);
        }