Exemple #1
0
        public async Task List_()
        {
            var loader = new RdfDataFetcher(_rdf);
            var g      = await loader.Load(Files.TestData.Sample1, Files.TestData.Brazil);

            Assert.AreEqual(1, g.Other.Length, "Loaded the data files.");
        }
Exemple #2
0
        public async Task Load_()
        {
            var loader = new RdfDataFetcher(_rdf);

            var brazil = await loader.Load(Files.TestData.Brazil);

            Assert.IsTrue(brazil.Query.Count > 0, "Loaded some data");
        }
Exemple #3
0
        public async Task Purge_()
        {
            var loader = new RdfDataFetcher(_rdf);

            var g = await loader.Load(Files.TestData.Sample1);

            loader.Purge(Files.TestData.Sample1);

            Assert.IsFalse(loader.List().Any(), "backing file removed.");
            _rdf.GetGraph(g.Id);
        }
Exemple #4
0
        public async Task Save_()
        {
            var file = Files.TestData.Sample1.CopyTo(
                Files.AppDataDir.GetFolder(nameof(RdfDataFetcherTests)), true);

            var loader = new RdfDataFetcher(_rdf);
            var g      = await loader.Load(file);

            var preUpdate = g.Query.Count;

            g.Assert(g.Blank(), g.Uri("app:isTest"), g.New(true));
            await loader.Save(g);

            g.Clear();

            await loader.Load(file);

            var postUpdate = g.Query.Count;

            Assert.IsTrue(postUpdate > preUpdate);
        }
Exemple #5
0
        public async Task Close_()
        {
            var loader = new RdfDataFetcher(_rdf);
            var sample = await loader.Load(Files.TestData.Sample1);

            var preClose = loader.List().Count;

            loader.Close(sample);

            var postClose = loader.List().Count;

            Assert.IsTrue(postClose < preClose, "File closed");
            Assert.IsTrue(sample.Query.Any(), "But data kept");
        }
Exemple #6
0
 /// <summary>
 /// (re)loads file data; existing graph data is overwritten.
 /// </summary>
 /// <returns>
 /// A Graph with all data, loaded graphs first.
 /// </returns>
 public static async Task <Graph> Load
     (this RdfDataFetcher self, params FileInfo[] file)
 => await self.Load(file.Select(x => Rdf(self).New(x)).ToArray());