Esempio n. 1
0
        public void HRef()
        {
            TestHtmlAnchor a = new TestHtmlAnchor();

            a.HRef = "~/otherfile.txt";
            Assert.AreEqual("~/otherfile.txt", a.HRef, "HRef");
            // resolve doesn't apply on the property
        }
Esempio n. 2
0
        [ExpectedException(typeof(NullReferenceException))]           // since 2.0 RC :-(
        public void RaisePostBackEvent()
        {
            TestHtmlAnchor a = new TestHtmlAnchor();

            a.ServerClick += new EventHandler(ServerClick);
            serverClick    = false;
            a.Raise();
            Assert.IsTrue(serverClick, "ServerClick");
        }
Esempio n. 3
0
        public void AbsoluteHRef()
        {
            TestHtmlAnchor a = new TestHtmlAnchor();

            a.HRef = "http://127.0.0.1/";
            HtmlTextWriter writer = a.GetWriter();

            Assert.AreEqual(" href=\"http://127.0.0.1/\"", writer.InnerWriter.ToString(), "#01");
        }
Esempio n. 4
0
        [ExpectedException(typeof(NullReferenceException))]           // since 2.0 RC :-(
#endif
        public void IPostBackEventHandler_RaisePostBackEvent()
        {
            TestHtmlAnchor a = new TestHtmlAnchor();

            a.ServerClick += new EventHandler(ServerClick);
            IPostBackEventHandler pbeh = (a as IPostBackEventHandler);

            serverClick = false;
            pbeh.RaisePostBackEvent("mono");
            Assert.IsTrue(serverClick, "ServerClick");
        }
Esempio n. 5
0
        public void RenderAttributes_Title_Null()
        {
            TestHtmlAnchor a = new TestHtmlAnchor();

            Assert.AreEqual(0, a.Attributes.Count, "#1");
            a.HRef   = "*1*";
            a.Name   = "*2*";
            a.Target = "*3*";
            a.Title  = null;
            Assert.AreEqual(3, a.Attributes.Count, "#2");

            HtmlTextWriter writer = a.GetWriter();

            Assert.AreEqual(" href=\"*1*\" name=\"*2*\" target=\"*3*\"", writer.InnerWriter.ToString(), "#3");
        }
Esempio n. 6
0
        public void RenderAttributes_HRef_Empty()
        {
            TestHtmlAnchor a = new TestHtmlAnchor();

            Assert.AreEqual(0, a.Attributes.Count, "#1");
            a.HRef   = string.Empty;
            a.Name   = "*2*";
            a.Target = "*3*";
            a.Title  = "*4*";
            Assert.AreEqual(3, a.Attributes.Count, "#2");

            HtmlTextWriter writer = a.GetWriter();

            Assert.AreEqual(" name=\"*2*\" target=\"*3*\" title=\"*4*\"", writer.InnerWriter.ToString(), "#3");
        }
Esempio n. 7
0
        public void ViewState2()
        {
            TestHtmlAnchor a = new TestHtmlAnchor();

            a.TrakState();
            a.CausesValidation = false;
            a.ValidationGroup  = "VG";

            object s = a.SaveState();

            TestHtmlAnchor copy = new TestHtmlAnchor();

            copy.LoadState(s);

            Assert.AreEqual(false, copy.CausesValidation, "A1");
            Assert.AreEqual("VG", copy.ValidationGroup, "A2");
        }
Esempio n. 8
0
        public void RenderAttributes()
        {
            TestHtmlAnchor a = new TestHtmlAnchor();

            a.HRef   = "*1*";
            a.Name   = "*2*";
            a.Target = "*3*";
            a.Title  = "*4*";
            Assert.AreEqual(4, a.Attributes.Count, "Attributes.Count/4");

            HtmlTextWriter writer = a.GetWriter();

            Assert.AreEqual(" href=\"*1*\" name=\"*2*\" target=\"*3*\" title=\"*4*\"", writer.InnerWriter.ToString(), "attributes");

            // HRef is missing, from the attributes collection, after rendering
            Assert.AreEqual(3, a.Attributes.Count, "Attributes.Count/3");
            Assert.AreEqual(String.Empty, a.HRef, "HRef");
            // but href is still rendered
            Assert.AreEqual(" href=\"*1*\" name=\"*2*\" target=\"*3*\" title=\"*4*\"", writer.InnerWriter.ToString(), "HRef is back");
        }
Esempio n. 9
0
		public void ViewState2 () {
			TestHtmlAnchor a = new TestHtmlAnchor ();
			a.TrakState ();
			a.CausesValidation = false;
			a.ValidationGroup = "VG";
			
			object s = a.SaveState ();
			
			TestHtmlAnchor copy = new TestHtmlAnchor ();
			
			copy.LoadState (s);

			Assert.AreEqual (false, copy.CausesValidation, "A1");
			Assert.AreEqual ("VG", copy.ValidationGroup, "A2");
		}
Esempio n. 10
0
		[ExpectedException (typeof (NullReferenceException))] // since 2.0 RC :-(
		public void RaisePostBackEvent ()
		{
			TestHtmlAnchor a = new TestHtmlAnchor ();
			a.ServerClick += new EventHandler (ServerClick);
			serverClick = false;
			a.Raise ();
			Assert.IsTrue (serverClick, "ServerClick");
		}
Esempio n. 11
0
		public void AbsoluteHRef ()
		{
			TestHtmlAnchor a = new TestHtmlAnchor ();
			a.HRef = "http://127.0.0.1/";
			HtmlTextWriter writer = a.GetWriter ();
			Assert.AreEqual (" href=\"http://127.0.0.1/\"", writer.InnerWriter.ToString (), "#01");
		}
Esempio n. 12
0
		[ExpectedException (typeof (NullReferenceException))] // since 2.0 RC :-(
#endif
		public void IPostBackEventHandler_RaisePostBackEvent ()
		{
			TestHtmlAnchor a = new TestHtmlAnchor ();
			a.ServerClick += new EventHandler (ServerClick);
			IPostBackEventHandler pbeh = (a as IPostBackEventHandler);
			serverClick = false;
			pbeh.RaisePostBackEvent ("mono");
			Assert.IsTrue (serverClick, "ServerClick");
		}
Esempio n. 13
0
		public void RenderAttributes_Title_Null ()
		{
			TestHtmlAnchor a = new TestHtmlAnchor ();
			Assert.AreEqual (0, a.Attributes.Count, "#1");
			a.HRef = "*1*";
			a.Name = "*2*";
			a.Target = "*3*";
			a.Title = null;
			Assert.AreEqual (3, a.Attributes.Count, "#2");

			HtmlTextWriter writer = a.GetWriter ();
			Assert.AreEqual (" href=\"*1*\" name=\"*2*\" target=\"*3*\"", writer.InnerWriter.ToString (), "#3");
		}
Esempio n. 14
0
		public void RenderAttributes_HRef_Empty ()
		{
			TestHtmlAnchor a = new TestHtmlAnchor ();
			Assert.AreEqual (0, a.Attributes.Count, "#1");
			a.HRef = string.Empty;
			a.Name = "*2*";
			a.Target = "*3*";
			a.Title = "*4*";
			Assert.AreEqual (3, a.Attributes.Count, "#2");

			HtmlTextWriter writer = a.GetWriter ();
			Assert.AreEqual (" name=\"*2*\" target=\"*3*\" title=\"*4*\"", writer.InnerWriter.ToString (), "#3");
		}
Esempio n. 15
0
		public void RenderAttributes ()
		{
			TestHtmlAnchor a = new TestHtmlAnchor ();
			a.HRef = "*1*";
			a.Name = "*2*";
			a.Target = "*3*";
			a.Title = "*4*";
			Assert.AreEqual (4, a.Attributes.Count, "Attributes.Count/4");

			HtmlTextWriter writer = a.GetWriter ();
			Assert.AreEqual (" href=\"*1*\" name=\"*2*\" target=\"*3*\" title=\"*4*\"", writer.InnerWriter.ToString (), "attributes");

			// HRef is missing, from the attributes collection, after rendering
			Assert.AreEqual (3, a.Attributes.Count, "Attributes.Count/3");
			Assert.AreEqual (String.Empty, a.HRef, "HRef");
			// but href is still rendered
			Assert.AreEqual (" href=\"*1*\" name=\"*2*\" target=\"*3*\" title=\"*4*\"", writer.InnerWriter.ToString (), "HRef is back");
		}
Esempio n. 16
0
		public void HRef ()
		{
			TestHtmlAnchor a = new TestHtmlAnchor ();
			a.HRef = "~/otherfile.txt";
			Assert.AreEqual ("~/otherfile.txt", a.HRef, "HRef");
			// resolve doesn't apply on the property
		}