Пример #1
0
        public void Controls_Table_Dual()
        {
#if NET_4_0
            string origHtml1 = "<tr>\n\t<td>mono</td>\n</tr>";
            string origHtml2 = "<tr>\n\t<td>mono</td>\n</tr>";
            string origHtml3 = "<table>\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table><table>\n\t<tr>\n\t\t<td>monkey</td>\n\t</tr>\n</table>";
            string origHtml4 = "<span><table>\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table><table>\n\t<tr>\n\t\t<td>monkey</td>\n\t</tr>\n</table></span>";
#else
            string origHtml1 = "<tr>\n\t<td>mono</td>\n</tr>";
            string origHtml2 = "<tr>\n\t<td>mono</td>\n</tr>";
            string origHtml3 = "<table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table><table border=\"0\">\n\t<tr>\n\t\t<td>monkey</td>\n\t</tr>\n</table>";
            string origHtml4 = "<span><table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table><table border=\"0\">\n\t<tr>\n\t\t<td>monkey</td>\n\t</tr>\n</table></span>";
#endif
            TestDataListItem dli = new TestDataListItem(0, ListItemType.Item);
            dli.Controls.Add(GetTable("mono"));
            dli.Controls.Add(GetTable("monkey"));

            // the second table is ignored if extractRows is true
            string renderedHtml = dli.Render(true, true);
            Assert.AreEqual(origHtml1, renderedHtml, "Render-Empty-T-T");

            renderedHtml = dli.Render(true, false);
            Assert.AreEqual(origHtml2, renderedHtml, "Render-Empty-T-F");

            // but not if extractRows is false
            renderedHtml = dli.Render(false, true);
            Assert.AreEqual(Adjust(origHtml3), Adjust(renderedHtml), "Render-Empty-F-T");

            renderedHtml = dli.Render(false, false);
            Assert.AreEqual(Adjust(origHtml4), Adjust(renderedHtml), "Render-Empty-F-F");
        }
Пример #2
0
        public void Controls_Table()
        {
            TestDataListItem dli = new TestDataListItem(0, ListItemType.Item);

            dli.Controls.Add(GetTable("mono"));

            Assert.AreEqual("<tr>\n\t<td>mono</td>\n</tr>", dli.Render(true, true), "Render-Empty-T-T");
            Assert.AreEqual("<tr>\n\t<td>mono</td>\n</tr>", dli.Render(true, false), "Render-Empty-T-F");
            Assert.AreEqual(Adjust("<table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table>"), Adjust(dli.Render(false, true)), "Render-Empty-F-T");
            Assert.AreEqual(Adjust("<span><table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table></span>"), Adjust(dli.Render(false, false)), "Render-Empty-F-F");
        }
Пример #3
0
        public void Controls_LiteralControl()
        {
            TestDataListItem dli = new TestDataListItem(0, ListItemType.Item);
            LiteralControl   lc  = new LiteralControl("mono");

            dli.Controls.Add(lc);

            // there's no table here (but there are controls), so calling Render with true for
            // extractRows cause a NullReferenceException on MS implementation
            //Assert.AreEqual ("<tr>\n\t<td></td>\n<\tr>", dli.Render (true, true), "Render-Empty-T-T");
            //Assert.AreEqual ("<tr>\n\t<td></td>\n<\tr>", dli.Render (true, false), "Render-Empty-T-F");
            Assert.AreEqual("mono", dli.Render(false, true), "Render-Empty-F-T");
            Assert.AreEqual("<span>mono</span>", dli.Render(false, false), "Render-Empty-F-F");
        }
Пример #4
0
        public void Controls_Table_Dual()
        {
            TestDataListItem dli = new TestDataListItem(0, ListItemType.Item);

            dli.Controls.Add(GetTable("mono"));
            dli.Controls.Add(GetTable("monkey"));

            // the second table is ignored if extractRows is true
            Assert.AreEqual("<tr>\n\t<td>mono</td>\n</tr>", dli.Render(true, true), "Render-Empty-T-T");
            Assert.AreEqual("<tr>\n\t<td>mono</td>\n</tr>", dli.Render(true, false), "Render-Empty-T-F");
            // but not if extractRows is false
            Assert.AreEqual(Adjust("<table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table><table border=\"0\">\n\t<tr>\n\t\t<td>monkey</td>\n\t</tr>\n</table>"), Adjust(dli.Render(false, true)), "Render-Empty-F-T");
            Assert.AreEqual(Adjust("<span><table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table><table border=\"0\">\n\t<tr>\n\t\t<td>monkey</td>\n\t</tr>\n</table></span>"), Adjust(dli.Render(false, false)), "Render-Empty-F-F");
        }
Пример #5
0
		private void BaseTests (TestDataListItem dli)
		{
			Assert.IsNull (dli.DataItem, "DataItem");
			Assert.AreEqual (String.Empty, dli.Render (true, true), "Render-Empty-T-T");
			Assert.AreEqual (String.Empty, dli.Render (true, false), "Render-Empty-T-F");
			Assert.AreEqual (String.Empty, dli.Render (false, true), "Render-Empty-F-T");
			Assert.AreEqual ("<span></span>", dli.Render (false, false), "Render-Empty-F-F");

			dli.DataItem = (object)Int32.MaxValue;
			Assert.AreEqual (Int32.MaxValue, dli.DataItem, "DataItem-Int32");
			Assert.AreEqual (String.Empty, dli.Render (true, true), "Render-Int32-T-T");
			Assert.AreEqual (String.Empty, dli.Render (true, false), "Render-Int32-T-F");
			Assert.AreEqual (String.Empty, dli.Render (false, true), "Render-Int32-F-T");
			Assert.AreEqual ("<span></span>", dli.Render (false, false), "Render-Int32-F-F");

			dli.DataItem = (object)"mono";
			Assert.AreEqual ("mono", dli.DataItem, "DataItem-String");
			Assert.AreEqual (String.Empty, dli.Render (true, true), "Render-String-T-T");
			Assert.AreEqual (String.Empty, dli.Render (true, false), "Render-String-T-F");
			Assert.AreEqual (String.Empty, dli.Render (false, true), "Render-String-F-T");
			Assert.AreEqual ("<span></span>", dli.Render (false, false), "Render-String-F-F");
		}
Пример #6
0
        public void Controls_Table()
        {
            string           origHtml1 = "<tr>\n\t<td>mono</td>\n</tr>";
            string           origHtml2 = "<tr>\n\t<td>mono</td>\n</tr>";
            string           origHtml3 = "<table>\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table>";
            string           origHtml4 = "<span><table>\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table></span>";
            TestDataListItem dli       = new TestDataListItem(0, ListItemType.Item);

            dli.Controls.Add(GetTable("mono"));

            string renderedHtml = dli.Render(true, true);

            Assert.AreEqual(origHtml1, renderedHtml, "Render-Empty-T-T");

            renderedHtml = dli.Render(true, false);
            Assert.AreEqual(origHtml2, renderedHtml, "Render-Empty-T-F");

            renderedHtml = dli.Render(false, true);
            Assert.AreEqual(Adjust(origHtml3), Adjust(renderedHtml), "Render-Empty-F-T");

            renderedHtml = dli.Render(false, false);
            Assert.AreEqual(Adjust(origHtml4), Adjust(renderedHtml), "Render-Empty-F-F");
        }
Пример #7
0
        private void BaseTests(TestDataListItem dli)
        {
            Assert.IsNull(dli.DataItem, "DataItem");
            Assert.AreEqual(String.Empty, dli.Render(true, true), "Render-Empty-T-T");
            Assert.AreEqual(String.Empty, dli.Render(true, false), "Render-Empty-T-F");
            Assert.AreEqual(String.Empty, dli.Render(false, true), "Render-Empty-F-T");
            Assert.AreEqual("<span></span>", dli.Render(false, false), "Render-Empty-F-F");

            dli.DataItem = (object)Int32.MaxValue;
            Assert.AreEqual(Int32.MaxValue, dli.DataItem, "DataItem-Int32");
            Assert.AreEqual(String.Empty, dli.Render(true, true), "Render-Int32-T-T");
            Assert.AreEqual(String.Empty, dli.Render(true, false), "Render-Int32-T-F");
            Assert.AreEqual(String.Empty, dli.Render(false, true), "Render-Int32-F-T");
            Assert.AreEqual("<span></span>", dli.Render(false, false), "Render-Int32-F-F");

            dli.DataItem = (object)"mono";
            Assert.AreEqual("mono", dli.DataItem, "DataItem-String");
            Assert.AreEqual(String.Empty, dli.Render(true, true), "Render-String-T-T");
            Assert.AreEqual(String.Empty, dli.Render(true, false), "Render-String-T-F");
            Assert.AreEqual(String.Empty, dli.Render(false, true), "Render-String-F-T");
            Assert.AreEqual("<span></span>", dli.Render(false, false), "Render-String-F-F");
        }
Пример #8
0
		public void Controls_LiteralControl ()
		{
			TestDataListItem dli = new TestDataListItem (0, ListItemType.Item);
			LiteralControl lc = new LiteralControl ("mono");
			dli.Controls.Add (lc);

			// there's no table here (but there are controls), so calling Render with true for 
			// extractRows cause a NullReferenceException on MS implementation
			//Assert.AreEqual ("<tr>\n\t<td></td>\n<\tr>", dli.Render (true, true), "Render-Empty-T-T");
			//Assert.AreEqual ("<tr>\n\t<td></td>\n<\tr>", dli.Render (true, false), "Render-Empty-T-F");
			Assert.AreEqual ("mono", dli.Render (false, true), "Render-Empty-F-T");
			Assert.AreEqual ("<span>mono</span>", dli.Render (false, false), "Render-Empty-F-F");
		}
Пример #9
0
		public void Controls_Table_Dual ()
		{
			string origHtml1 = "<tr>\n\t<td>mono</td>\n</tr>";
			string origHtml2 = "<tr>\n\t<td>mono</td>\n</tr>";
			string origHtml3 = "<table>\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table><table>\n\t<tr>\n\t\t<td>monkey</td>\n\t</tr>\n</table>";
			string origHtml4 = "<span><table>\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table><table>\n\t<tr>\n\t\t<td>monkey</td>\n\t</tr>\n</table></span>";
			TestDataListItem dli = new TestDataListItem (0, ListItemType.Item);
			dli.Controls.Add (GetTable ("mono"));
			dli.Controls.Add (GetTable ("monkey"));

			// the second table is ignored if extractRows is true
			string renderedHtml = dli.Render (true, true);
			Assert.AreEqual (origHtml1, renderedHtml, "Render-Empty-T-T");

			renderedHtml = dli.Render (true, false);
			Assert.AreEqual (origHtml2, renderedHtml, "Render-Empty-T-F");

			// but not if extractRows is false
			renderedHtml = dli.Render (false, true);
			Assert.AreEqual (Adjust (origHtml3), Adjust (renderedHtml), "Render-Empty-F-T");

			renderedHtml = dli.Render (false, false);
			Assert.AreEqual (Adjust (origHtml4), Adjust (renderedHtml), "Render-Empty-F-F");
		}
		public void Controls_Table ()
		{
#if NET_4_0
			string origHtml1 = "<tr>\n\t<td>mono</td>\n</tr>";
			string origHtml2 = "<tr>\n\t<td>mono</td>\n</tr>";
			string origHtml3 = "<table>\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table>";
			string origHtml4 = "<span><table>\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table></span>";
#else
			string origHtml1 = "<tr>\n\t<td>mono</td>\n</tr>";
			string origHtml2 = "<tr>\n\t<td>mono</td>\n</tr>";
			string origHtml3 = "<table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table>";
			string origHtml4 = "<span><table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table></span>";
#endif
			TestDataListItem dli = new TestDataListItem (0, ListItemType.Item);
			dli.Controls.Add (GetTable ("mono"));

			string renderedHtml = dli.Render (true, true);
			Assert.AreEqual (origHtml1, renderedHtml, "Render-Empty-T-T");

			renderedHtml = dli.Render (true, false);
			Assert.AreEqual (origHtml2, renderedHtml, "Render-Empty-T-F");

			renderedHtml = dli.Render (false, true);
			Assert.AreEqual (Adjust (origHtml3), Adjust (renderedHtml), "Render-Empty-F-T");

			renderedHtml = dli.Render (false, false);
			Assert.AreEqual (Adjust (origHtml4), Adjust (renderedHtml), "Render-Empty-F-F");
		}
		public void Controls_Table_Dual ()
		{
			TestDataListItem dli = new TestDataListItem (0, ListItemType.Item);
			dli.Controls.Add (GetTable ("mono"));
			dli.Controls.Add (GetTable ("monkey"));

			// the second table is ignored if extractRows is true
			Assert.AreEqual ("<tr>\n\t<td>mono</td>\n</tr>", dli.Render (true, true), "Render-Empty-T-T");
			Assert.AreEqual ("<tr>\n\t<td>mono</td>\n</tr>", dli.Render (true, false), "Render-Empty-T-F");
			// but not if extractRows is false
			Assert.AreEqual (Adjust ("<table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table><table border=\"0\">\n\t<tr>\n\t\t<td>monkey</td>\n\t</tr>\n</table>"), Adjust (dli.Render (false, true)), "Render-Empty-F-T");
			Assert.AreEqual (Adjust ("<span><table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table><table border=\"0\">\n\t<tr>\n\t\t<td>monkey</td>\n\t</tr>\n</table></span>"), Adjust (dli.Render (false, false)), "Render-Empty-F-F");
		}
		public void Controls_Table ()
		{
			TestDataListItem dli = new TestDataListItem (0, ListItemType.Item);
			dli.Controls.Add (GetTable ("mono"));

			Assert.AreEqual ("<tr>\n\t<td>mono</td>\n</tr>", dli.Render (true, true), "Render-Empty-T-T");
			Assert.AreEqual ("<tr>\n\t<td>mono</td>\n</tr>", dli.Render (true, false), "Render-Empty-T-F");
			Assert.AreEqual (Adjust ("<table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table>"), Adjust (dli.Render (false, true)), "Render-Empty-F-T");
			Assert.AreEqual (Adjust ("<span><table border=\"0\">\n\t<tr>\n\t\t<td>mono</td>\n\t</tr>\n</table></span>"), Adjust (dli.Render (false, false)), "Render-Empty-F-F");
		}