コード例 #1
0
ファイル: BasicTests1.cs プロジェクト: keremdemirer/dotnetrdf
        public void NodesUriNodeEquality()
        {
            //Create the Nodes
            Graph g = new Graph();

            Console.WriteLine("Creating two URIs referring to google - one lowercase, one uppercase - which should be equivalent");
            IUriNode a = g.CreateUriNode(new Uri("http://www.google.com"));
            IUriNode b = g.CreateUriNode(new Uri("http://www.GOOGLE.com/"));

            TestTools.CompareNodes(a, b, true);

            Console.WriteLine("Creating two URIs with the same Fragment ID but differing in case and thus are different since Fragment IDs are case sensitive => not equals");
            IUriNode c = g.CreateUriNode(new Uri("http://www.google.com/#Test"));
            IUriNode d = g.CreateUriNode(new Uri("http://www.GOOGLE.com/#test"));

            TestTools.CompareNodes(c, d, false);

            Console.WriteLine("Creating two identical URIs with unusual characters in them");
            IUriNode e = g.CreateUriNode(new Uri("http://www.google.com/random,_@characters"));
            IUriNode f = g.CreateUriNode(new Uri("http://www.google.com/random,_@characters"));

            TestTools.CompareNodes(e, f, true);

            Console.WriteLine("Creating two URIs with similar paths that differ in case");
            IUriNode h = g.CreateUriNode(new Uri("http://www.google.com/path/test/case"));
            IUriNode i = g.CreateUriNode(new Uri("http://www.google.com/path/Test/case"));

            TestTools.CompareNodes(h, i, false);

            Console.WriteLine("Creating three URIs with equivalent relative paths");
            IUriNode j = g.CreateUriNode(new Uri("http://www.google.com/relative/test/../example.html"));
            IUriNode k = g.CreateUriNode(new Uri("http://www.google.com/relative/test/monkey/../../example.html"));
            IUriNode l = g.CreateUriNode(new Uri("http://www.google.com/relative/./example.html"));

            TestTools.CompareNodes(j, k, true);
            TestTools.CompareNodes(k, l, true);
        }