private static Dictionary<string, OntologyAttribute> CreateNamespaceDictionary()
 {
     Dictionary<string, OntologyAttribute> dict = new Dictionary<string, OntologyAttribute>();
     dict["a"] = new OntologyAttribute { Name = "Namea"};
     dict["b"] = new OntologyAttribute { Name = "Nameb" };
     dict["c"] = new OntologyAttribute { Name = "Namec" };
     dict["d"] = new OntologyAttribute { Name = "Named" };
     return dict;
 }
 private Dictionary<string, OntologyAttribute> CreateRealisticNamespaceDictionary()
 {
     Dictionary<string, OntologyAttribute> dict = new Dictionary<string, OntologyAttribute>();
     dict["Name1"] = new OntologyAttribute
     {
         BaseUri = "BaseUri1",
         GraphName = "GraphName1",
         Name = "Name1",
         Prefix = "Prefix1",
         UrlOfOntology = "UrlOfOntology1"
     };
     dict["Name2"] = new OntologyAttribute
     {
         BaseUri = "BaseUri2",
         GraphName = "GraphName2",
         Name = "Name2",
         Prefix = "Prefix2",
         UrlOfOntology = "UrlOfOntology2"
     };
     dict["Name3"] = new OntologyAttribute
     {
         BaseUri = "BaseUri3",
         GraphName = "GraphName3",
         Name = "Name3",
         Prefix = "Prefix3",
         UrlOfOntology = "UrlOfOntology3"
     };
     dict["Name4"] = new OntologyAttribute
     {
         BaseUri = "BaseUri4",
         GraphName = "GraphName4",
         Name = "Name4",
         Prefix = "Prefix4",
         UrlOfOntology = "UrlOfOntology4"
     };
     return dict;
 }
 public string CreateNewPrefixFor(OntologyAttribute ontology)
 {
     string result = generatedNamespaceChar.ToString();
     IncrementNamespace();
     return result;
 }
 public void AddNewDefaultNamespace(OntologyAttribute ontology, string name)
 {
     Rename("", name);
     Default = ontology;
 }
 public void TestAddDefaultOntology()
 {
     Dictionary<string, OntologyAttribute> dict = CreateRealisticNamespaceDictionary();
     nsm = new NamespaceManager(dict);
     nsm[""] = new OntologyAttribute
     {
         BaseUri = "BaseUri4",
         GraphName = "GraphName4",
         Name = "Name4",
         Prefix = "Prefix4",
         UrlOfOntology = "UrlOfOntology4"
     };
     Assert.IsNotNull(nsm[""]);
     Assert.IsTrue(nsm[""] == nsm.Default);
 }
 public void TestAddClashingOntology()
 {
     Dictionary<string, OntologyAttribute> dict = CreateRealisticNamespaceDictionary();
     nsm = new NamespaceManager(dict);
     try
     {
         Assert.IsNotNull(nsm["Name1"]);
         Assert.IsTrue(nsm.Count == 4);
         nsm["Name1"] = new OntologyAttribute
         {
             BaseUri = "BaseUri1",
             GraphName = "GraphName1",
             Name = "Name1",
             Prefix = "Prefix1",
             UrlOfOntology = "UrlOfOntology1"
         };
         Assert.Fail("Should have thrown an exception");
     }
     catch { }
     Assert.IsNotNull(nsm["Name1"]);
     Assert.IsTrue(nsm.Count == 4);
 }
 public void TestCreateWithDictionary()
 {
     OntologyAttribute expectedOntology = new OntologyAttribute();
     Dictionary<string, OntologyAttribute> dict = new Dictionary<string, OntologyAttribute>();
     dict["ontology"] = expectedOntology;
     dict["b"] = new OntologyAttribute();
     dict["c"] = new OntologyAttribute();
     dict["d"] = new OntologyAttribute();
     nsm = new NamespaceManager(dict);
     Assert.IsTrue(nsm.Count == 4);
     Assert.IsTrue(nsm["ontology"] == expectedOntology);
 }
 public void TestAddNonClashingOntology()
 {
     Dictionary<string, OntologyAttribute> dict = CreateRealisticNamespaceDictionary();
     nsm = new NamespaceManager(dict);
     nsm["mytest"] = new OntologyAttribute
     {
         BaseUri = "mytest",
         GraphName = "mytest",
         Name = "mytest",
         Prefix = "mytest",
         UrlOfOntology = "mytest"
     };
     Assert.IsNotNull(nsm["mytest"]);
     Assert.IsTrue(nsm.Count == 5);
 }