Skip to content
Snippets Groups Projects
Select Git revision
  • master
  • gitkeep
  • dev protected
  • Sprint/2022-01
  • Hotfix/1911-fixFormatting
  • Sprint/2021-22
  • Issue/1743-changedLink
  • Sprint/2021-08
  • Hotfix/1475-projectCreateSpinner
  • Sprint/2021-05
  • Hotfix/1376-projectCreation
  • Sprint/2021-04
  • Product/789-userContactEmail
  • Topic/1295-contactChangeUi
  • v1.0.4
  • v1.0.3
  • v1.0.2
  • v1.0.1
  • v1.0.0
19 results

TokenConfirmationApp.vue

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    MetadataTests.cs 2.92 KiB
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Coscine.Configuration;
    using Coscine.Metadata.Models;
    using NUnit.Framework;
    using VDS.RDF;
    using VDS.RDF.Parsing;
    
    namespace Coscine.Metadata.Tests
    {
        [TestFixture]
        public class MetadataTests
        {
    
            private readonly IConfiguration _configuration = new ConsulConfiguration();
    
            private RdfStoreConnector _rdfStoreConnector;
    
            private const string _testUriPrefix = "http://test.de";
    
            //private string _shapeGraph = File.ReadAllText("Metadata.Tests/TestFiles/radar_shape.ttl");
            //private string _dataGraph = File.ReadAllText("Metadata.Tests/TestFiles/radar_input.ttl");
    
            private void RemoveTestGraphs()
            {
                foreach (var grapUri in _rdfStoreConnector.ListGraphs())
                {
                    if (grapUri.ToString().StartsWith(_testUriPrefix))
                    {
                        _rdfStoreConnector.DeleteGraph(grapUri);
                    }
                }
            }
    
            private void AddTestGraphs()
            {
    
            }
    
            [OneTimeSetUp]
            public void Init()
            {
                _rdfStoreConnector = new RdfStoreConnector(_configuration.GetStringAndWait("coscine/local/virtuoso/additional/url"));
                RemoveTestGraphs();
                AddTestGraphs();
            }
    
            [OneTimeTearDown]
            public void Cleanup()
            {
                RemoveTestGraphs();
            }
    
            [Test]
            public void HasGraphTest()
            {
                Assert.IsTrue(_rdfStoreConnector.HasGraph("http://www.openlinksw.com/schemas/virtrdf#"));
                Assert.IsTrue(_rdfStoreConnector.HasGraph("http://localhost:8890/DAV/"));
                Assert.IsFalse(_rdfStoreConnector.HasGraph("https://test.de/fdgdhjklö/"));
            }
    
            [Test]
            public void GetGraphTest()
            {
                Assert.IsFalse(_rdfStoreConnector.GetGraph("http://www.openlinksw.com/schemas/virtrdf#").IsEmpty);
                Assert.IsFalse(_rdfStoreConnector.GetGraph("http://localhost:8890/DAV/").IsEmpty);
                // Returns an empty graph, if the graph does not exists
                Assert.IsTrue(_rdfStoreConnector.GetGraph("https://test.de/fdgdhjklö/").IsEmpty);