Exemplo n.º 1
0
        public void NullProperties()
        {
            TestHtmlSelect sel = new TestHtmlSelect();

            sel.DataMember = null;
            Assert.AreEqual(String.Empty, sel.DataMember, "DataMember");
            sel.DataSource = null;
            Assert.AreEqual(null, sel.DataSource, "DataSource");
            sel.DataTextField = null;
            Assert.AreEqual(String.Empty, sel.DataTextField, "DataTextField");
            sel.DataValueField = null;
            Assert.AreEqual(String.Empty, sel.DataValueField, "DataValueField");
            sel.Multiple = false;
            Assert.AreEqual(false, sel.Multiple, "Multiple");
            sel.SelectedIndex = -1;
            Assert.AreEqual(0, sel.SelectedIndex, "SelectedIndex");
            sel.Size = -1;
            Assert.AreEqual(-1, sel.Size, "Size");
            sel.Value = null;
            Assert.AreEqual(String.Empty, sel.Value, "Value");

            Assert.AreEqual(0, sel.Attributes.Count, "Attributes.Count");

            StateBag sb = sel.GetViewState();

            Assert.AreEqual(0, sb.Count, "ViewState Count");
        }
Exemplo n.º 2
0
        public void ViewStateCount()
        {
            TestHtmlSelect sel = new TestHtmlSelect();

            int[] source = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };

            sel.DataMember = "*1*";
            Assert.AreEqual("*1*", sel.DataMember, "DataMember");
            sel.DataSource = source;
            Assert.AreEqual(source, sel.DataSource, "DataSource");
            sel.DataTextField = "*3*";
            Assert.AreEqual("*3*", sel.DataTextField, "DataTextField");
            sel.DataValueField = "*4*";
            Assert.AreEqual("*4*", sel.DataValueField, "DataValueField");
            sel.Multiple = true;
            Assert.AreEqual(true, sel.Multiple, "Multiple");
            sel.SelectedIndex = 6;
            /* This doesn't stick */
            Assert.AreEqual(-1, sel.SelectedIndex, "SelectedIndex");
            sel.Size = 7;
            Assert.AreEqual(7, sel.Size, "Size");
            sel.Value = "*8*";
            /* Neither does this */
            Assert.AreEqual(String.Empty, sel.Value, "Value");

            Assert.AreEqual(5, sel.Attributes.Count, "Attributes.Count");

            /*
             * foreach (string key in sel.Attributes.Keys) {
             *      Console.WriteLine ("attr key {0} is {1}", key, sel.Attributes[key]);
             * }
             */

            StateBag sb = sel.GetViewState();

            Assert.AreEqual(5, sb.Count, "ViewState Count");

            /*
             * foreach (string key in sb.Keys) {
             *      Console.WriteLine ("vs key {0} is {1}", key, sb[key]);
             * }
             */
        }
Exemplo n.º 3
0
		public void ViewStateCount ()
		{
			TestHtmlSelect sel = new TestHtmlSelect ();
			int[] source = new int[] {1,2,3,4,5,6,7,8};
			
			sel.DataMember = "*1*";
			Assert.AreEqual ("*1*", sel.DataMember, "DataMember");
			sel.DataSource = source;
			Assert.AreEqual (source, sel.DataSource, "DataSource");
			sel.DataTextField = "*3*";
			Assert.AreEqual ("*3*", sel.DataTextField, "DataTextField");
			sel.DataValueField = "*4*";
			Assert.AreEqual ("*4*", sel.DataValueField, "DataValueField");
			sel.Multiple = true;
			Assert.AreEqual (true, sel.Multiple, "Multiple");
			sel.SelectedIndex = 6;
			/* This doesn't stick */
			Assert.AreEqual (-1, sel.SelectedIndex, "SelectedIndex");
			sel.Size = 7;
			Assert.AreEqual (7, sel.Size, "Size");
			sel.Value = "*8*";
			/* Neither does this */
			Assert.AreEqual (String.Empty, sel.Value, "Value");

			Assert.AreEqual (5, sel.Attributes.Count, "Attributes.Count");
			/*
			foreach (string key in sel.Attributes.Keys) {
				Console.WriteLine ("attr key {0} is {1}", key, sel.Attributes[key]);
			}
			*/
			
			StateBag sb = sel.GetViewState ();
			Assert.AreEqual (5, sb.Count, "ViewState Count");

			/*
			foreach (string key in sb.Keys) {
				Console.WriteLine ("vs key {0} is {1}", key, sb[key]);
			}
			*/
		}
Exemplo n.º 4
0
		public void NullProperties ()
		{
			TestHtmlSelect sel = new TestHtmlSelect ();

			sel.DataMember = null;
			Assert.AreEqual (String.Empty, sel.DataMember, "DataMember");
			sel.DataSource = null;
			Assert.AreEqual (null, sel.DataSource, "DataSource");
			sel.DataTextField = null;
			Assert.AreEqual (String.Empty, sel.DataTextField, "DataTextField");
			sel.DataValueField = null;
			Assert.AreEqual (String.Empty, sel.DataValueField, "DataValueField");
			sel.Multiple = false;
			Assert.AreEqual (false, sel.Multiple, "Multiple");
			sel.SelectedIndex = -1;
			Assert.AreEqual (0, sel.SelectedIndex, "SelectedIndex");
			sel.Size = -1;
			Assert.AreEqual (-1, sel.Size, "Size");
			sel.Value = null;
			Assert.AreEqual (String.Empty, sel.Value, "Value");

			Assert.AreEqual (0, sel.Attributes.Count, "Attributes.Count");

			StateBag sb = sel.GetViewState ();
			Assert.AreEqual (0, sb.Count, "ViewState Count");
		}