예제 #1
0
        public void LocationTest()
        {
            var testLocation = new JSONDataSourceLocation("test path", true);

            Assert.NotNull(testLocation);
            Assert.AreEqual("test path", testLocation.Path);
            Assert.AreEqual(true, testLocation.IsArray);
        }
예제 #2
0
        public void ParseTest()
        {
            var path               = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DataFiles", "TestJSONFile.json");
            var dataSource         = new WindowsFileSystem(path);
            var dataFromFileSystem = dataSource.FetchData();

            var dataSourceLocation = new JSONDataSourceLocation("objects[*].name", true);
            var dataToImport       = new JSONDataToImport(dataFromFileSystem);

            var parserFactory = new DefaultParserFactory();

            var testParser = new SimpleJSONObjectParser(parserFactory);

            var parseResults = testParser.Parse(dataToImport, dataSourceLocation, typeof(string)) as ParsingResult;

            dynamic result = parseResults.Value;

            Assert.NotNull(parseResults);
            Assert.AreEqual("Cruise", result[0]);
            Assert.AreEqual("Data retrieval", result[1]);
            Assert.AreEqual("Derivation", result[2]);
        }