Ejemplo n.º 1
0
		public void DefaultPropertiesTest ()
		{
			StatusBar bar = new StatusBar ();
			StatusBar.StatusBarPanelCollection collection = new StatusBar.StatusBarPanelCollection (bar);
			
			Assert.AreEqual (0, collection.Count, "C1");
			Assert.AreEqual (false, collection.IsReadOnly, "I1");
		}
Ejemplo n.º 2
0
		public void Insert()
		{
			StatusBar bar = new StatusBar ();
			StatusBar.StatusBarPanelCollection collection = new StatusBar.StatusBarPanelCollection (bar);

			StatusBarPanel panel = new StatusBarPanel ();
			StatusBarPanel panel2 = new StatusBarPanel ();

			collection.Add (panel);
			Assert.AreEqual (1, collection.Count, "#1");

			collection.Insert (0, panel);
			Assert.AreEqual (2, collection.Count, "#2");
		}
Ejemplo n.º 3
0
		public void Interface_Insert()
		{
			// Copy of test, for the equivalent ICollection/IList members.
			//
			StatusBar bar = new StatusBar ();
			StatusBar.StatusBarPanelCollection collectionX = new StatusBar.StatusBarPanelCollection (bar);
			IList collection = collectionX;

			StatusBarPanel panel = new StatusBarPanel ();
			StatusBarPanel panel2 = new StatusBarPanel ();

			collection.Add (panel);
			Assert.AreEqual (1, collection.Count, "#1");

			collection.Insert (0, panel);
			Assert.AreEqual (2, collection.Count, "#2");
		}
Ejemplo n.º 4
0
		public void Interface_AddRemoveTest()
		{
			// Copy of test, for the equivalent ICollection/IList members.
			//
			StatusBar bar = new StatusBar ();
			StatusBar.StatusBarPanelCollection collectionX = new StatusBar.StatusBarPanelCollection (bar);
			IList collection = collectionX;

			StatusBarPanel panel = new StatusBarPanel ();
			StatusBarPanel panel2 = new StatusBarPanel ();

			collection.Add (panel);
			Assert.AreEqual (1, collection.Count, "#1");

			collection.Remove (panel);
			Assert.AreEqual (0, collection.Count, "#2");

			collection.Add (panel);
			collection.RemoveAt (0);
			Assert.AreEqual (0, collection.Count, "#3");

			collection.Add (panel);
			Assert.AreEqual (0, collection.IndexOf (panel), "#4");
			Assert.AreEqual (-1, collection.IndexOf (panel2), "#5");

			collection.Add (panel2);
			Assert.AreEqual (1, collection.IndexOf (panel2), "#6");

			collection.RemoveAt (0);
			Assert.AreEqual (0, collection.IndexOf (panel2), "#7");
			Assert.AreEqual (1, collection.Count, "#8");

			Assert.AreEqual (false, collection.Contains (panel), "#9");
			Assert.AreEqual (true, collection.Contains (panel2), "#10");

		}
Ejemplo n.º 5
0
		public void IndexByKeyTest ()
		{
			StatusBar bar = new StatusBar ();
			StatusBar.StatusBarPanelCollection c = new StatusBar.StatusBarPanelCollection (bar);

			StatusBarPanel panel1 = new StatusBarPanel ();
			StatusBarPanel panel2 = new StatusBarPanel ();
			StatusBarPanel panel3 = new StatusBarPanel ();
			StatusBarPanel panel4 = new StatusBarPanel ();
			StatusBarPanel panel5 = new StatusBarPanel ();


			panel1.Name = "p1";
			panel2.Name = "p2";
			panel3.Name = "P2";
			panel4.Name = "";
			panel5.Name = null;

			c.AddRange (new StatusBarPanel [] { panel1, panel2, panel3, panel4, panel5 });
			
			Assert.AreEqual (-1, c.IndexOfKey (""), "#1");
			Assert.AreEqual (-1, c.IndexOfKey (null), "#2");
			Assert.AreEqual (0, c.IndexOfKey ("p1"), "#3");
			Assert.AreEqual (0, c.IndexOfKey ("P1"), "#4");
			Assert.AreEqual (1, c.IndexOfKey ("p2"), "#5");
			Assert.AreEqual (1, c.IndexOfKey ("P2"), "#6");
			Assert.AreEqual (-1, c.IndexOfKey ("p3"), "#7");
			Assert.AreEqual (-1, c.IndexOfKey ("p"), "#8");			
		}
Ejemplo n.º 6
0
		public void RemoveByKeyTest ()
		{
			StatusBar bar = new StatusBar ();
			StatusBar.StatusBarPanelCollection c = new StatusBar.StatusBarPanelCollection (bar);

			StatusBarPanel panel1 = new StatusBarPanel ();
			StatusBarPanel panel2 = new StatusBarPanel ();
			StatusBarPanel panel3 = new StatusBarPanel ();
			StatusBarPanel panel4 = new StatusBarPanel ();
			StatusBarPanel panel5 = new StatusBarPanel ();


			panel1.Name = "p1";
			panel2.Name = "p2";
			panel3.Name = "P2";
			panel4.Name = "";
			panel5.Name = null;

			c.AddRange (new StatusBarPanel [] { panel1, panel2, panel3, panel4, panel5 });

			Assert.AreEqual (true, c.ContainsKey ("p1"), "#A1");
			Assert.AreEqual (true, c.ContainsKey ("P1"), "#A2");
			Assert.AreEqual (true, c.ContainsKey ("P2"), "#A3");
			Assert.AreEqual (false, c.ContainsKey (""), "#A4");
			Assert.AreEqual (false, c.ContainsKey (null), "#A5");
			Assert.AreEqual (false, c.ContainsKey ("p3"), "#A6");
			Assert.AreEqual (false, c.ContainsKey ("p"), "#A7");
			Assert.AreEqual (null, c [""], "#A8");
			Assert.AreEqual (null, c [null], "#A9");
			Assert.AreEqual (panel1, c ["p1"], "#A10");
			Assert.AreEqual (panel1, c ["P1"], "#A11");
			Assert.AreEqual (panel2, c ["p2"], "#A12");
			Assert.AreEqual (panel2, c ["P2"], "#A13");
			Assert.AreEqual (null, c ["p3"], "#A14");
			Assert.AreEqual (null, c ["p"], "#A15");	
			
			c.RemoveByKey ("P2");

			Assert.AreEqual (true, c.ContainsKey ("p1"), "#B1");
			Assert.AreEqual (true, c.ContainsKey ("P1"), "#B2");
			Assert.AreEqual (true, c.ContainsKey ("P2"), "#B3");
			Assert.AreEqual (false, c.ContainsKey (""), "#B4");
			Assert.AreEqual (false, c.ContainsKey (null), "#B5");
			Assert.AreEqual (false, c.ContainsKey ("p3"), "#B6");
			Assert.AreEqual (false, c.ContainsKey ("p"), "#B7");
			Assert.AreEqual (null, c [""], "#B8");
			Assert.AreEqual (null, c [null], "#B9");
			Assert.AreEqual (panel1, c ["p1"], "#B10");
			Assert.AreEqual (panel1, c ["P1"], "#B11");
			Assert.AreEqual (panel3, c ["p2"], "#B12");
			Assert.AreEqual (panel3, c ["P2"], "#B13");
			Assert.AreEqual (null, c ["p3"], "#B14");
			Assert.AreEqual (null, c ["p"], "#B15");

			c.RemoveByKey ("p2");

			Assert.AreEqual (true, c.ContainsKey ("p1"), "#C1");
			Assert.AreEqual (true, c.ContainsKey ("P1"), "#C2");
			Assert.AreEqual (false, c.ContainsKey ("P2"), "#C3");
			Assert.AreEqual (false, c.ContainsKey (""), "#C4");
			Assert.AreEqual (false, c.ContainsKey (null), "#C5");
			Assert.AreEqual (false, c.ContainsKey ("p3"), "#C6");
			Assert.AreEqual (false, c.ContainsKey ("p"), "#C7");
			Assert.AreEqual (null, c [""], "#C8");
			Assert.AreEqual (null, c [null], "#C9");
			Assert.AreEqual (panel1, c ["p1"], "#C10");
			Assert.AreEqual (panel1, c ["P1"], "#C11");
			Assert.AreEqual (null, c ["p2"], "#C12");
			Assert.AreEqual (null, c ["P2"], "#C13");
			Assert.AreEqual (null, c ["p3"], "#C14");
			Assert.AreEqual (null, c ["p"], "#C15");

			c.RemoveByKey ("p2");

			Assert.AreEqual (true, c.ContainsKey ("p1"), "#D1");
			Assert.AreEqual (true, c.ContainsKey ("P1"), "#D2");
			Assert.AreEqual (false, c.ContainsKey ("P2"), "#D3");
			Assert.AreEqual (false, c.ContainsKey (""), "#D4");
			Assert.AreEqual (false, c.ContainsKey (null), "#D5");
			Assert.AreEqual (false, c.ContainsKey ("p3"), "#D6");
			Assert.AreEqual (false, c.ContainsKey ("p"), "#D7");
			Assert.AreEqual (null, c [""], "#D8");
			Assert.AreEqual (null, c [null], "#D9");
			Assert.AreEqual (panel1, c ["p1"], "#D10");
			Assert.AreEqual (panel1, c ["P1"], "#D11");
			Assert.AreEqual (null, c ["p2"], "#D12");
			Assert.AreEqual (null, c ["P2"], "#D13");
			Assert.AreEqual (null, c ["p3"], "#D14");
			Assert.AreEqual (null, c ["p"], "#D15");
			
			c.RemoveByKey ("P1");

			Assert.AreEqual (false, c.ContainsKey ("p1"), "#E1");
			Assert.AreEqual (false, c.ContainsKey ("P1"), "#E2");
			Assert.AreEqual (false, c.ContainsKey ("P2"), "#E3");
			Assert.AreEqual (false, c.ContainsKey (""), "#E4");
			Assert.AreEqual (false, c.ContainsKey (null), "#E5");
			Assert.AreEqual (false, c.ContainsKey ("p3"), "#E6");
			Assert.AreEqual (false, c.ContainsKey ("p"), "#E7");
			Assert.AreEqual (null, c [""], "#E8");
			Assert.AreEqual (null, c [null], "#E9");
			Assert.AreEqual (null, c ["p1"], "#E10");
			Assert.AreEqual (null, c ["P1"], "#E11");
			Assert.AreEqual (null, c ["p2"], "#E12");
			Assert.AreEqual (null, c ["P2"], "#E13");
			Assert.AreEqual (null, c ["p3"], "#E14");
			Assert.AreEqual (null, c ["p"], "#E15");

			c.RemoveByKey ("");

			Assert.AreEqual (false, c.ContainsKey ("p1"), "#F1");
			Assert.AreEqual (false, c.ContainsKey ("P1"), "#F2");
			Assert.AreEqual (false, c.ContainsKey ("P2"), "#F3");
			Assert.AreEqual (false, c.ContainsKey (""), "#F4");
			Assert.AreEqual (false, c.ContainsKey (null), "#F5");
			Assert.AreEqual (false, c.ContainsKey ("p3"), "#F6");
			Assert.AreEqual (false, c.ContainsKey ("p"), "#F7");
			Assert.AreEqual (null, c [""], "#F8");
			Assert.AreEqual (null, c [null], "#F9");
			Assert.AreEqual (null, c ["p1"], "#F10");
			Assert.AreEqual (null, c ["P1"], "#F11");
			Assert.AreEqual (null, c ["p2"], "#F12");
			Assert.AreEqual (null, c ["P2"], "#F13");
			Assert.AreEqual (null, c ["p3"], "#F14");
			Assert.AreEqual (null, c ["p"], "#F15");


			c.RemoveByKey (null);

			Assert.AreEqual (false, c.ContainsKey ("p1"), "#G1");
			Assert.AreEqual (false, c.ContainsKey ("P1"), "#G2");
			Assert.AreEqual (false, c.ContainsKey ("P2"), "#G3");
			Assert.AreEqual (false, c.ContainsKey (""), "#G4");
			Assert.AreEqual (false, c.ContainsKey (null), "#G5");
			Assert.AreEqual (false, c.ContainsKey ("p3"), "#G6");
			Assert.AreEqual (false, c.ContainsKey ("p"), "#G7");
			Assert.AreEqual (null, c [""], "#G8");
			Assert.AreEqual (null, c [null], "#G9");
			Assert.AreEqual (null, c ["p1"], "#G10");
			Assert.AreEqual (null, c ["P1"], "#G11");
			Assert.AreEqual (null, c ["p2"], "#G12");
			Assert.AreEqual (null, c ["P2"], "#G13");
			Assert.AreEqual (null, c ["p3"], "#G14");
			Assert.AreEqual (null, c ["p"], "#G15");
			
		}
Ejemplo n.º 7
0
		public void ItemByKeyTest ()
		{
			StatusBar bar = new StatusBar ();
			StatusBar.StatusBarPanelCollection c = new StatusBar.StatusBarPanelCollection (bar);

			StatusBarPanel panel1 = new StatusBarPanel ();
			StatusBarPanel panel2 = new StatusBarPanel ();
			StatusBarPanel panel3 = new StatusBarPanel ();
			StatusBarPanel panel4 = new StatusBarPanel ();
			StatusBarPanel panel5 = new StatusBarPanel ();


			panel1.Name = "p1";
			panel2.Name = "p2";
			panel3.Name = "P2";
			panel4.Name = "";
			panel5.Name = null;

			c.AddRange (new StatusBarPanel [] { panel1, panel2, panel3, panel4, panel5 });

			Assert.AreEqual (null, c [""], "#1");
			Assert.AreEqual (null, c [null], "#2");
			Assert.AreEqual (panel1, c ["p1"], "#3");
			Assert.AreEqual (panel1, c ["P1"], "#4");
			Assert.AreEqual (panel2, c ["p2"], "#5");
			Assert.AreEqual (panel2, c ["P2"], "#6");
			Assert.AreEqual (null, c ["p3"], "#7");
			Assert.AreEqual (null, c ["p"], "#8");	
		}
Ejemplo n.º 8
0
		public void AddRemoveTest ()
		{
			StatusBar bar = new StatusBar ();
			StatusBar.StatusBarPanelCollection collection = new StatusBar.StatusBarPanelCollection (bar);

			StatusBarPanel panel = new StatusBarPanel ();
			StatusBarPanel panel2 = new StatusBarPanel ();
			
			collection.Add (panel);
			Assert.AreEqual (1, collection.Count, "#1");

			collection.Remove (panel);
			Assert.AreEqual (0, collection.Count, "#2");

			collection.Add (panel);
			collection.RemoveAt (0);
			Assert.AreEqual (0, collection.Count, "#3");

			collection.Add (panel);
			Assert.AreEqual (0, collection.IndexOf (panel), "#4");
			Assert.AreEqual (-1, collection.IndexOf (panel2), "#5");

			collection.Add (panel2);
			Assert.AreEqual (1, collection.IndexOf (panel2), "#6");

			collection.RemoveAt (0);
			Assert.AreEqual (0, collection.IndexOf (panel2), "#7");
			Assert.AreEqual (1, collection.Count, "#8");
			
			Assert.AreEqual (false, collection.Contains (panel), "#9");
			Assert.AreEqual (true, collection.Contains (panel2), "#10");
			
		}