public void Initialize_1()
        {
            var provider = new XmlSiteMapProviderPoker();

            provider.Initialize("TestMap", null);
            Assert.AreEqual("TestMap", provider.Name, "#A1");
        }
Beispiel #2
0
		public void AddNode_Null_2 ()
		{
			var provider = new XmlSiteMapProviderPoker ();
			var node = new SiteMapNode (provider, "/test.aspx");

			provider.DoAddNode (node, null);
		}
        public void Initialize_2()
        {
            var provider = new XmlSiteMapProviderPoker();

            provider.Initialize("TestMap", new NameValueCollection());
            Assert.AreEqual("TestMap", provider.Name, "#A1");
        }
        public void AddNode_Null_2()
        {
            var provider = new XmlSiteMapProviderPoker();
            var node     = new SiteMapNode(provider, "/test.aspx");

            provider.DoAddNode(node, null);
        }
        public void AddNode_DifferentProviders_02()
        {
            var provider   = new XmlSiteMapProviderPoker();
            var node       = new SiteMapNode(provider, "/test.aspx");
            var parentNode = new SiteMapNode(new TestSiteMapProvider(), "/test2.aspx");

            // SiteMapNode  cannot be found in current provider, only nodes in the same provider can be added.
            provider.DoAddNode(node, parentNode);
        }
        public void Initialize_6()
        {
            var provider = new XmlSiteMapProviderPoker();

            provider.Initialize("TestMap", null);

            // XmlSiteMapProvider cannot be initialized twice
            provider.Initialize("TestMap2", null);
        }
        public void RootNode_1()
        {
            var provider = new XmlSiteMapProviderPoker();

            // Thrown from internal GetConfigDocument ():
            // The siteMapFile attribute must be specified on the XmlSiteMapProvider
            provider.Initialize("TestMap", null);
            var rn = provider.RootNode;
        }
        public void Initialize_3()
        {
            var provider = new XmlSiteMapProviderPoker();
            var nvc      = new NameValueCollection();

            nvc.Add("siteMapFile", "test.sitemap");
            provider.Initialize("TestMap", nvc);
            Assert.AreEqual("TestMap", provider.Name, "#A1");
        }
        public static void InvalidFileExtension_OnLoad(Page p)
        {
            var provider = new XmlSiteMapProviderPoker();
            var nvc      = new NameValueCollection();

            nvc.Add("siteMapFile", "~/test_map_01.extension");

            provider.Initialize("TestMap", nvc);
            var rn = provider.RootNode;
        }
Beispiel #10
0
        public static void MissingMapFile_OnLoad(Page p)
        {
            var provider = new XmlSiteMapProviderPoker();
            var nvc      = new NameValueCollection();

            nvc.Add("siteMapFile", "~/missing_map_file.sitemap");

            provider.Initialize("TestMap", nvc);
            var rn = provider.RootNode;
        }
Beispiel #11
0
        public static void InvalidMapFile_OnLoad(string filePath, Page p)
        {
            var provider = new XmlSiteMapProviderPoker();
            var nvc      = new NameValueCollection();

            nvc.Add("siteMapFile", filePath);

            provider.Initialize("TestMap", nvc);
            var rn = provider.RootNode;
        }
Beispiel #12
0
        public void Initialize_5()
        {
            var provider = new XmlSiteMapProviderPoker();
            var nvc      = new NameValueCollection();

            nvc.Add("siteMapFile", "test.sitemap");
            nvc.Add("description", "Test XML provider");

            // The attribute 'acme' is unexpected in the configuration of the 'TestMap' provider.
            nvc.Add("acme", "test provider");
            provider.Initialize("TestMap", nvc);
        }
Beispiel #13
0
        public void AddNode_01()
        {
            var provider   = new XmlSiteMapProviderPoker();
            var node       = new SiteMapNode(provider, "/test.aspx");
            var parentNode = new SiteMapNode(provider, "/test2.aspx");

            var nvc = new NameValueCollection();

            nvc.Add("siteMapFile", "~/test_map_01.sitemap");
            provider.Initialize("TestMap", nvc);

            // The application relative virtual path '~/test_map_01.sitemap' cannot be made absolute, because the path to the application is not known.
            provider.DoAddNode(node, parentNode);
        }
Beispiel #14
0
        public static void NodeWithSiteMapFile_01_OnLoad(Page p)
        {
            var provider = new XmlSiteMapProviderPoker();
            var nvc      = new NameValueCollection();

            nvc.Add("siteMapFile", "~/test_map_02.sitemap");

            provider.Initialize("TestMap", nvc);
            var rn = provider.RootNode;

            string expectedTreeString = "UNTITLED_0[0]; Test 1[1]; Sub 1 [/NunitWeb/sub_map_01.sitemap][1]; Sub Sub 1 [/NunitWeb/sub_map_01.sitemap][2]";
            string treeString         = provider.GetTreeString();

            Assert.AreEqual(expectedTreeString, treeString, "#A1");
        }
Beispiel #15
0
        public static void RootNode_2_OnLoad(Page p)
        {
            var provider = new XmlSiteMapProviderPoker();

            provider.CallTrace = null;
            var nvc = new NameValueCollection();

            nvc.Add("siteMapFile", "~/test_map_01.sitemap");
            provider.CallTrace = null;
            provider.Initialize("TestMap", nvc);
            Assert.IsNotNull(provider.RootNode, "#A1");
            Assert.AreEqual(provider.RootNode.Provider, provider, "#A2");
            Assert.IsNotNull(provider.CallTrace, "#A3");
            Assert.Greater(provider.CallTrace.Length, 1, "#A3-1");
            Assert.AreEqual(provider.CallTrace[0].Name, "BuildSiteMap", "#A3-2");
            Assert.AreEqual(provider.CallTrace[1].Name, "get_RootNode", "#A3-3");
        }
Beispiel #16
0
        public static void MapFileWithNonStandardAttributes_OnLoad(Page p)
        {
            var provider = new XmlSiteMapProviderPoker();
            var nvc      = new NameValueCollection();

            nvc.Add("siteMapFile", "~/test_map_09.sitemap");

            provider.Initialize("TestMap", nvc);
            var rn = provider.RootNode;

            //TODO: find out what happens to non-standard attributes
            //SiteMapNode node = rn.ChildNodes[0];
            //Assert.IsNotNull (node, "#A1");
            //Assert.AreEqual ("some, keyword, another, one", node["keywords"], "#A1-1");

            //node = rn.ChildNodes[1];
            //Assert.IsNotNull (node, "#B1");
            //Assert.AreEqual("value", node["someattribute"], "#B1-1");
        }
Beispiel #17
0
        public static void NodeWithProvider_OnLoad(string filePath, Page p)
        {
            var provider = new XmlSiteMapProviderPoker();
            var nvc      = new NameValueCollection();

            nvc.Add("siteMapFile", filePath);

            provider.Initialize("TestMap", nvc);
            var rn = provider.RootNode;

            string expectedTreeString = "UNTITLED_0[0]; Test 1[1]; Test [TestSiteMapProvider][1]";
            string treeString         = provider.GetTreeString();

            Assert.AreEqual(expectedTreeString, treeString, "#A1");

            SiteMapNode node = provider.FindSiteMapNode("default.aspx");

            Assert.IsNotNull(node, "#B1");
            Assert.AreEqual("Test", node.Title, "#B1-1");
        }
Beispiel #18
0
        public static void AddNode_02_OnLoad(Page p)
        {
            var provider = new XmlSiteMapProviderPoker();

            provider.CallTrace = null;
            var nvc = new NameValueCollection();

            nvc.Add("siteMapFile", "~/test_map_01.sitemap");
            provider.Initialize("TestMap", nvc);

            SiteMapNode rootNode = provider.RootNode;

            provider.CallTrace = null;

            var node = new SiteMapNode(provider, "test3.aspx", "~/test3.aspx");

            provider.DoAddNode(node, rootNode);

            Assert.IsNotNull(provider.CallTrace, "#A1");
            Assert.Greater(provider.CallTrace.Length, 1, "#A1-1");
            Assert.AreEqual(provider.CallTrace[0].Name, "BuildSiteMap", "#A1-2");
        }
Beispiel #19
0
		public void Initialize_1 ()
		{
			var provider = new XmlSiteMapProviderPoker ();

			provider.Initialize ("TestMap", null);
			Assert.AreEqual ("TestMap", provider.Name, "#A1");
		}
Beispiel #20
0
		public static void RootNode_2_OnLoad (Page p)
		{
			var provider = new XmlSiteMapProviderPoker ();
			provider.CallTrace = null;
			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", "~/test_map_01.sitemap");
			provider.CallTrace = null;
			provider.Initialize ("TestMap", nvc);
			Assert.IsNotNull (provider.RootNode, "#A1");
			Assert.AreEqual (provider.RootNode.Provider, provider, "#A2");
			Assert.IsNotNull (provider.CallTrace, "#A3");
			Assert.Greater (provider.CallTrace.Length, 1, "#A3-1");
			Assert.AreEqual ("BuildSiteMap", provider.CallTrace[0].Name, "#A3-2");
			Assert.AreEqual ("get_RootNode", provider.CallTrace[1].Name, "#A3-3");
		}
Beispiel #21
0
		public void RootNode_1 ()
		{
			var provider = new XmlSiteMapProviderPoker ();

			// Thrown from internal GetConfigDocument ():
			// The siteMapFile attribute must be specified on the XmlSiteMapProvider
			provider.Initialize ("TestMap", null);
			var rn = provider.RootNode;
		}
Beispiel #22
0
		public static void InvalidFileExtension_OnLoad (Page p)
		{
			var provider = new XmlSiteMapProviderPoker ();
			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", "~/test_map_01.extension");

			provider.Initialize ("TestMap", nvc);
			var rn = provider.RootNode;
		}
Beispiel #23
0
		public void Initialize_4 ()
		{
			var provider = new XmlSiteMapProviderPoker ();
			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", "test.sitemap");
			nvc.Add ("description", "Test XML provider");
			provider.Initialize ("TestMap", nvc);
			Assert.AreEqual ("TestMap", provider.Name, "#A1");
			Assert.AreEqual ("Test XML provider", provider.Description, "#A2");
		}
Beispiel #24
0
		public static void NodeWithSiteMapFile_01_OnLoad (Page p)
		{
			var provider = new XmlSiteMapProviderPoker ();
			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", "~/test_map_02.sitemap");

			provider.Initialize ("TestMap", nvc);
			var rn = provider.RootNode;

			string expectedTreeString = "UNTITLED_0[0]; Test 1[1]; Sub 1 [/NunitWeb/sub_map_01.sitemap][1]; Sub Sub 1 [/NunitWeb/sub_map_01.sitemap][2]";
			string treeString = provider.GetTreeString ();

			Assert.AreEqual (expectedTreeString, treeString, "#A1");
		}
Beispiel #25
0
		public static void MissingMapFile_OnLoad (Page p)
		{
			var provider = new XmlSiteMapProviderPoker ();
			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", "~/missing_map_file.sitemap");

			provider.Initialize ("TestMap", nvc);
			var rn = provider.RootNode;
		}
Beispiel #26
0
		public static void MapFileWithNonStandardAttributes_OnLoad (Page p)
		{
			var provider = new XmlSiteMapProviderPoker ();
			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", "~/test_map_09.sitemap");

			provider.Initialize ("TestMap", nvc);
			var rn = provider.RootNode;

			//TODO: find out what happens to non-standard attributes
			//SiteMapNode node = rn.ChildNodes[0];
			//Assert.IsNotNull (node, "#A1");
			//Assert.AreEqual ("some, keyword, another, one", node["keywords"], "#A1-1");

			//node = rn.ChildNodes[1];
			//Assert.IsNotNull (node, "#B1");
			//Assert.AreEqual("value", node["someattribute"], "#B1-1");
		}
Beispiel #27
0
		public void AddNode_DifferentProviders_01 ()
		{
			var provider = new XmlSiteMapProviderPoker ();
			var node = new SiteMapNode (new TestSiteMapProvider (), "/test.aspx");
			var parentNode = new SiteMapNode (provider, "/test2.aspx");

			// SiteMapNode  cannot be found in current provider, only nodes in the same provider can be added.
			provider.DoAddNode (node, parentNode);
		}
Beispiel #28
0
		public void Initialize_2 ()
		{
			var provider = new XmlSiteMapProviderPoker ();

			provider.Initialize ("TestMap", new NameValueCollection ());
			Assert.AreEqual ("TestMap", provider.Name, "#A1");
		}
Beispiel #29
0
		public void Initialize_6 ()
		{
			var provider = new XmlSiteMapProviderPoker ();

			provider.Initialize ("TestMap", null);

			// XmlSiteMapProvider cannot be initialized twice
			provider.Initialize ("TestMap2", null);
		}
Beispiel #30
0
		public static void AddNode_02_OnLoad (Page p)
		{
			var provider = new XmlSiteMapProviderPoker ();
			provider.CallTrace = null;
			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", "~/test_map_01.sitemap");
			provider.Initialize ("TestMap", nvc);

			SiteMapNode rootNode = provider.RootNode;
			provider.CallTrace = null;

			var node = new SiteMapNode (provider, "test3.aspx", "~/test3.aspx");
			provider.DoAddNode (node, rootNode);

			Assert.IsNotNull (provider.CallTrace, "#A1");
			Assert.Greater (provider.CallTrace.Length, 1, "#A1-1");
			Assert.AreEqual (provider.CallTrace[0].Name, "BuildSiteMap", "#A1-2");
		}
Beispiel #31
0
		public static void NodeWithProvider_OnLoad (string filePath, Page p)
		{
			var provider = new XmlSiteMapProviderPoker ();
			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", filePath);

			provider.Initialize ("TestMap", nvc);
			var rn = provider.RootNode;

			string expectedTreeString = "UNTITLED_0[0]; Test 1[1]; Test [TestSiteMapProvider][1]";
			string treeString = provider.GetTreeString ();
			Assert.AreEqual (expectedTreeString, treeString, "#A1");

			SiteMapNode node = provider.FindSiteMapNode ("default.aspx");
			Assert.IsNotNull (node, "#B1");
			Assert.AreEqual ("Test", node.Title, "#B1-1");
		}
Beispiel #32
0
		public static void InvalidMapFile_OnLoad (string filePath, Page p)
		{
			var provider = new XmlSiteMapProviderPoker ();
			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", filePath);

			provider.Initialize ("TestMap", nvc);
			var rn = provider.RootNode;
		}
Beispiel #33
0
		public void AddNode_01 ()
		{
			var provider = new XmlSiteMapProviderPoker ();
			var node = new SiteMapNode (provider, "/test.aspx");
			var parentNode = new SiteMapNode (provider, "/test2.aspx");

			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", "~/test_map_01.sitemap");
			provider.Initialize ("TestMap", nvc);

			// The application relative virtual path '~/test_map_01.sitemap' cannot be made absolute, because the path to the application is not known.
			provider.DoAddNode (node, parentNode);
		}
Beispiel #34
0
		public void Initialize_5 ()
		{
			var provider = new XmlSiteMapProviderPoker ();
			var nvc = new NameValueCollection ();
			nvc.Add ("siteMapFile", "test.sitemap");
			nvc.Add ("description", "Test XML provider");

			// The attribute 'acme' is unexpected in the configuration of the 'TestMap' provider.
			nvc.Add ("acme", "test provider");
			provider.Initialize ("TestMap", nvc);
		}