Esempio n. 1
0
        public void When_object_is_root_then_path_should_be_built_correctly()
        {
            //// Arrange
            var objectToSearch = new JsonSchema4();

            //// Act
            var foundObject = JsonPathUtilities.GetObjectFromJsonPath(objectToSearch, "#");

            //// Assert
            Assert.AreEqual(foundObject, objectToSearch);
        }
Esempio n. 2
0
        public void When_object_is_in_property_then_path_should_be_built_correctly()
        {
            //// Arrange
            var objectToSearch = new JsonSchema4();
            var obj            = new
            {
                Property = new
                {
                    Property1 = new { },
                    Property2 = objectToSearch
                }
            };

            //// Act
            var foundObject = JsonPathUtilities.GetObjectFromJsonPath(obj, "#/Property/Property2");

            //// Assert
            Assert.AreEqual(foundObject, objectToSearch);
        }
Esempio n. 3
0
        public void When_object_is_in_dictionary_then_path_should_be_built_correctly()
        {
            //// Arrange
            var objectToSearch = new JsonSchema4();
            var obj            = new
            {
                Property = new
                {
                    List = new Dictionary <string, object>
                    {
                        { "Test1", new { } },
                        { "Test2", new { } },
                        { "Test3", objectToSearch },
                    }
                }
            };

            //// Act
            var foundObject = JsonPathUtilities.GetObjectFromJsonPath(obj, "#/Property/List/Test3");

            //// Assert
            Assert.AreEqual(foundObject, objectToSearch);
        }