当前位置: 首页>>代码示例>>C#>>正文


C# Set.Equals方法代码示例

本文整理汇总了C#中System.Collections.Set.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Set.Equals方法的具体用法?C# Set.Equals怎么用?C# Set.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Set的用法示例。


在下文中一共展示了Set.Equals方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckboxBehavior_SelectParentsThatWereNotInOwnershipTreeOfChildList

		public void CheckboxBehavior_SelectParentsThatWereNotInOwnershipTreeOfChildList()
		{
			m_bulkEditBar.SwitchTab("BulkCopy");
			m_bv.ShowColumn("ExampleTranslation");
			m_bulkEditBar.SetTargetField("Example Translations");
			RecordClerk clerk = (m_bv.Parent as RecordBrowseViewForTests).Clerk;
			// having fewer translations than parent entries is strange
			// but it's currently the only way we can allow bulk editing translations.
			// We can allow ghosting for Examples that don't have translations
			// but not for a translation of a ghosted (not-yet existing) Example.
			Assert.Less(clerk.ListSize, Cache.LangProject.LexDbOA.EntriesOC.Count);

			// Uncheck everything before we switch to parent list
			m_bv.OnUncheckAll();
			IList<int> uncheckedTranslationItems = m_bv.UncheckedItems();
			Assert.AreEqual(uncheckedTranslationItems.Count, clerk.ListSize);

			// go through each of the translation items, and find the LexEntry owner.
			IDictionary<int, int> translationsToEntries = GetParentOfClassMap(uncheckedTranslationItems,
				LexEntry.kclsidLexEntry);
			Set<int> expectedUnselectedEntries = new Set<int>(translationsToEntries.Values);

			// Now switch to Entries and expect the new parent items to be selected.
			using (FilterBehavior.Create(this))
				m_bulkEditBar.SetTargetField("Lexeme Form");

			Set<int> entriesSelected = new Set<int>(m_bv.CheckedItems);
			Set<int> entriesUnselected = new Set<int>(m_bv.UncheckedItems());
			Assert.AreEqual(expectedUnselectedEntries.Count, entriesUnselected.Count, "Unselected items mismatched.");
			Assert.IsTrue(expectedUnselectedEntries.Equals(entriesUnselected), "Unselected items mismatched.");
			Assert.Greater(entriesSelected.Count, 0);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:32,代码来源:BulkEditBarTests.cs

示例2: CheckboxBehavior_SiblingClassesItemsShouldInheritSelectionThroughParent_UnSelected

		public void CheckboxBehavior_SiblingClassesItemsShouldInheritSelectionThroughParent_UnSelected()
		{
			// first create an entry with a pronunciation and some senses.
			ILexPronunciation pronunciation;
			ILexEntry parentEntry = CreateZZZparentEntryWithMultipleSensesAndPronunciation(out pronunciation);

			m_bulkEditBar.SwitchTab("BulkCopy");
			m_bv.ShowColumn("Pronunciation");
			m_bulkEditBar.SetTargetField("Pronunciations");
			RecordClerk clerk = (m_bv.Parent as RecordBrowseViewForTests).Clerk;

			// go through each of the pronunciation items, and find the LexEntry owner.
			IDictionary<int, int> pronunciationsToEntries = GetParentOfClassMap(m_bv.AllItems,
				LexEntry.kclsidLexEntry);
			// Unselect one sibling
			m_bv.UnselectItem(pronunciation.Hvo);
			// now switch to (sense) sibling list
			using (FilterBehavior.Create(this))
				m_bulkEditBar.SetTargetField("Glosses");
			// validate that only the siblings are unselected.
			Set<int> hvoSenseSiblings = new Set<int>(FdoVectorUtils.ConvertCmObjectsToHvos<ILexSense>(parentEntry.AllSenses));
			Set<int> uncheckedItems = new Set<int>(m_bv.UncheckedItems());
			Assert.AreEqual(hvoSenseSiblings.Count, uncheckedItems.Count);
			Assert.IsTrue(hvoSenseSiblings.Equals(uncheckedItems));
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:25,代码来源:BulkEditBarTests.cs

示例3: CheckboxBehavior_ParentClassesItemsShouldInheritSelection_Selected

		public void CheckboxBehavior_ParentClassesItemsShouldInheritSelection_Selected()
		{
			// find a lex entry that has multiple senses (i.e. descendents).
			ILexEntry entryWithMultipleDescendents = CreateZZZparentEntryWithMultipleSensesAndPronunciation_AndUpdateList();
			// some entries (like variants) don't have senses, so we need to factor those into our results.
			ICollection<ILexEntry> entriesWithoutSenses = FindEntriesWithoutSenses();

			m_bulkEditBar.SwitchTab("BulkCopy");
			m_bulkEditBar.SetTargetField("Glosses");
			Assert.AreEqual(LexSense.kclsidLexSense, m_bv.ListItemsClass);
			RecordClerk clerk = (m_bv.Parent as RecordBrowseViewForTests).Clerk;

			m_bv.OnUncheckAll();
			// select the sense.
			m_bv.SetCheckedItems(new int[] { entryWithMultipleDescendents.AllSenses[0].Hvo });

			using (FilterBehavior.Create(this))
				m_bulkEditBar.SetTargetField("Lexeme Form");

			Set<int> selectedEntries = new Set<int>(new int[] {entryWithMultipleDescendents.Hvo});
			selectedEntries.AddRange(FdoVectorUtils.ConvertCmObjectsToHvos<ILexEntry>(entriesWithoutSenses));
			Set<int> checkedItems = new Set<int>(m_bv.CheckedItems);
			Assert.AreEqual(selectedEntries.Count, checkedItems.Count, "Checked items mismatched.");
			Assert.IsTrue(checkedItems.Equals(selectedEntries), "Checked items mismatched.");
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:25,代码来源:BulkEditBarTests.cs

示例4: CheckboxBehavior_ParentClassesItemsShouldInheritSelection_UnSelected

		public void CheckboxBehavior_ParentClassesItemsShouldInheritSelection_UnSelected()
		{
			// find a lex entry that has multiple senses (i.e. descendents).
			ILexEntry entryWithMultipleDescendents = CreateZZZparentEntryWithMultipleSensesAndPronunciation_AndUpdateList();

			m_bulkEditBar.SwitchTab("BulkCopy");
			m_bulkEditBar.SetTargetField("Glosses");
			Assert.AreEqual(LexSense.kclsidLexSense, m_bv.ListItemsClass);
			RecordClerk clerk = (m_bv.Parent as RecordBrowseViewForTests).Clerk;

			// unselect all the senses belonging to this entry
			m_bv.UncheckItems(FdoVectorUtils.ConvertCmObjectsToHvos<ILexSense>(entryWithMultipleDescendents.AllSenses));

			// switch to the parent list
			using (FilterBehavior.Create(this))
				m_bulkEditBar.SetTargetField("Lexeme Form");

			Set<int> unselectedEntries = new Set<int>(new int[] { entryWithMultipleDescendents.Hvo });
			Set<int> uncheckedItems = new Set<int>(m_bv.UncheckedItems());
			Assert.AreEqual(unselectedEntries.Count, uncheckedItems.Count, "Unchecked items mismatched.");
			Assert.IsTrue(uncheckedItems.Equals(unselectedEntries), "Unchecked items mismatched.");
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:22,代码来源:BulkEditBarTests.cs

示例5: CheckboxBehavior_DescendentItemsShouldInheritSelection_Select

		public virtual void CheckboxBehavior_DescendentItemsShouldInheritSelection_Select()
		{
			// find a lex entry that has multiple senses (i.e. descendents).
			ILexEntry entryWithMultipleDescendents = CreateZZZparentEntryWithMultipleSensesAndPronunciation_AndUpdateList();

			m_bulkEditBar.SwitchTab("BulkCopy");
			m_bulkEditBar.SetTargetField("Lexeme Form");
			Assert.AreEqual(LexEntry.kclsidLexEntry, m_bv.ListItemsClass);

			m_bv.OnUncheckAll();
			// select the entry.
			m_bv.SetCheckedItems(new List<int>(new int[] {entryWithMultipleDescendents.Hvo}));
			using (FilterBehavior.Create(this))
				m_bulkEditBar.SetTargetField("Glosses");

			Set<int> allSensesForEntry = new Set<int>(
				FdoVectorUtils.ConvertCmObjectsToHvos<ILexSense>(entryWithMultipleDescendents.AllSenses));
			Set<int> checkedItems = new Set<int>(m_bv.CheckedItems);
			Assert.AreEqual(allSensesForEntry.Count, checkedItems.Count, "Checked items mismatched.");
			Assert.IsTrue(checkedItems.Equals(allSensesForEntry), "Checked items mismatched.");
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:21,代码来源:BulkEditBarTests.cs


注:本文中的System.Collections.Set.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。