Like ListBox, FwListBox defines an ObjectCollection class for the items in the list. This class provides a subset of the functionality of the ArrayList used to implement it. The reason for not using an ArrayList is that operations that change the contents of the list have to have side effects on the control.
Inheritance: IList, ICollection, IEnumerable, IFWDisposable
Esempio n. 1
0
		public void Remove_CollectionWithSingleElement_CollectionShouldBeEmpty()
		{
			using (var listBox = new FwListBox())
			{
				using (var collection = new FwListBox.ObjectCollection(listBox))
				{
					ITsString testString = TsStringHelper.MakeTSS("test", m_hvoEnglishWs);
					collection.Add(testString);

					// The Test
					collection.Remove(testString);

					Assert.AreEqual(0, collection.Count);
					Assert.IsFalse(collection.Contains(testString));
				}
			}
		}
Esempio n. 2
0
		public void Add_EmptyObjectCollection_CollectionContainsSingleElement()
		{

			using (var listBox = new FwListBox())
			{

				using (var collection = new FwListBox.ObjectCollection(listBox))
				{
					ITsString testString = TsStringHelper.MakeTSS("test", m_hvoEnglishWs);

					// The Test
					collection.Add(testString);

					Assert.AreEqual(1, collection.Count);
					Assert.IsTrue(collection.Contains(testString));
				}
			}
	}
Esempio n. 3
0
		public void FwListBox_OneItem()
		{
			using (var fwList = new TestFwList())
			{
				using (var site = new TestListBox(fwList.DataAccess))
				{
					site.StyleSheet = FixtureStyleSheet;
					site.WritingSystemFactory = m_wsManager;
					site.WritingSystemCode = m_wsEng;
					using (new SimpleRootSiteDataProviderTestsHelper(site))
					{
						site.MakeRoot(InnerFwListBox.kfragRoot, () => new ListBoxVc(site));
						using (var items = new FwListBox.ObjectCollection(fwList))
						{
							TsStringUtils.MakeTss("Item0", m_wsEng);
							site.ShowForm();
							var selections = CollectorEnvServices.CollectStringPropertySelectionPoints(site.RootBox);
							Assert.AreEqual(1, selections.Count());
						}
					}
				}
			}
		}
Esempio n. 4
0
		public void SetIndex_CollectionWithSingleElement_ValueShouldHaveChanged()
		{
			using (var listBox = new FwListBox())
			{
				using (var collection = new FwListBox.ObjectCollection(listBox))
				{
					ITsString testString1 = TsStringHelper.MakeTSS("test1", m_hvoEnglishWs);
					ITsString testString2 = TsStringHelper.MakeTSS("test2", m_hvoEnglishWs);
					collection.Add(testString1);

					// The Test
					collection[0] = testString2;

					Assert.AreEqual(1, collection.Count);
					Assert.IsFalse(collection.Contains(testString1));
					Assert.IsTrue(collection.Contains(testString2));
				}
			}
		}