public void MapPathsOfJson_Expected_JsonPaths()
        {
            string testData = GivenJson();

            IDataBrowser        dataBrowser = DataBrowserFactory.CreateDataBrowser();
            IEnumerable <IPath> paths       = dataBrowser.Map(testData);

            Assert.IsTrue(paths.All(p => p.GetType() == typeof(JsonPath)));
        }
        public void MapPathsOfUnexpectedType_Expected_PocoPaths()
        {
            Uri uri = new Uri("/cake", UriKind.Relative);

            IDataBrowser        dataBrowser = DataBrowserFactory.CreateDataBrowser();
            IEnumerable <IPath> paths       = dataBrowser.Map(uri);

            Assert.IsTrue(paths.All(p => p.GetType() == typeof(PocoPath)));
        }
        public void MapPathsOfReferenceType_Expected_PocoPaths()
        {
            PocoTestData testData = GivenPoco();

            IDataBrowser        dataBrowser = DataBrowserFactory.CreateDataBrowser();
            IEnumerable <IPath> paths       = dataBrowser.Map(testData);

            Assert.IsTrue(paths.All(p => p.GetType() == typeof(PocoPath)));
        }
Example #4
0
        /// <summary>
        /// Map the data given in the StringData field of the payload using the DataBrowser
        /// </summary>
        public string MapStringData(string data)
        {
            string stringData = ValueExtractor.GetValueFromDataList("StringData", data);

            IDataBrowser        dataBrowser = DataBrowserFactory.CreateDataBrowser();
            IEnumerable <IPath> mappedPaths = dataBrowser.Map(stringData);

            string pathsString = string.Join(Environment.NewLine, mappedPaths.Select(p => p.DisplayPath));

            return("<ADL><PathData>" + pathsString + "</PathData></ADL>");
        }