本文整理汇总了C#中Set.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Set.Equals方法的具体用法?C# Set.Equals怎么用?C# Set.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Set
的用法示例。
在下文中一共展示了Set.Equals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckboxBehavior_SelectParentsThatWereNotInOwnershipTreeOfChildList
public void CheckboxBehavior_SelectParentsThatWereNotInOwnershipTreeOfChildList()
{
m_bulkEditBar.SwitchTab("BulkCopy");
m_bv.ShowColumn("ExampleTranslation");
m_bulkEditBar.SetTargetField("Example Translations");
var 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.Entries.Count());
// Uncheck everything before we switch to parent list
m_bv.OnUncheckAll();
var uncheckedTranslationItems = m_bv.UncheckedItems();
Assert.AreEqual(uncheckedTranslationItems.Count, clerk.ListSize);
// go through each of the translation items, and find the LexEntry owner.
var translationsToEntries = GetParentOfClassMap(uncheckedTranslationItems,
LexEntryTags.kClassId);
var 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");
var entriesSelected = new Set<int>(m_bv.CheckedItems);
var 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);
}
示例2: TechnicalTesting
public void TechnicalTesting()
{
var set = new Set<int>(1, 2, 3, 4);
Console.WriteLine(set.ToString());
Console.WriteLine(set.GetHashCode());
Console.WriteLine(set.Equals(new Set<int>(1, 2, 3, 4)));
}
示例3: 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");
var 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,
LexEntryTags.kClassId);
// 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.
var hvoSenseSiblings = new Set<int>(FdoVectorUtils.ConvertCmObjectsToHvos<ILexSense>(parentEntry.AllSenses));
var uncheckedItems = new Set<int>(m_bv.UncheckedItems());
Assert.AreEqual(hvoSenseSiblings.Count, uncheckedItems.Count);
Assert.IsTrue(hvoSenseSiblings.Equals(uncheckedItems));
}
示例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(LexSenseTags.kClassId, m_bv.ListItemsClass);
var 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");
var unselectedEntries = new Set<int>(new int[] { entryWithMultipleDescendents.Hvo });
var uncheckedItems = new Set<int>(m_bv.UncheckedItems());
Assert.AreEqual(unselectedEntries.Count, uncheckedItems.Count, "Unchecked items mismatched.");
Assert.IsTrue(uncheckedItems.Equals(unselectedEntries), "Unchecked items mismatched.");
}
示例5: 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(LexSenseTags.kClassId, m_bv.ListItemsClass);
var 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");
var selectedEntries = new Set<int>(new int[] { entryWithMultipleDescendents.Hvo });
selectedEntries.AddRange(FdoVectorUtils.ConvertCmObjectsToHvos(entriesWithoutSenses));
var checkedItems = new Set<int>(m_bv.CheckedItems);
Assert.AreEqual(selectedEntries.Count, checkedItems.Count, "Checked items mismatched.");
Assert.IsTrue(checkedItems.Equals(selectedEntries), "Checked items mismatched.");
}
示例6: CheckboxBehavior_DescendentItemsShouldInheritSelection_UnSelect
public virtual void CheckboxBehavior_DescendentItemsShouldInheritSelection_UnSelect()
{
// 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(LexEntryTags.kClassId, m_bv.ListItemsClass);
var clerk = (m_bv.Parent as RecordBrowseViewForTests).Clerk;
// unselect the entry.
m_bv.UnselectItem(entryWithMultipleDescendents.Hvo);
using (FilterBehavior.Create(this))
m_bulkEditBar.SetTargetField("Glosses");
var allSensesForEntry = new Set<int>(FdoVectorUtils.ConvertCmObjectsToHvos(
entryWithMultipleDescendents.AllSenses));
var uncheckedItems = new Set<int>(m_bv.UncheckedItems());
Assert.AreEqual(allSensesForEntry.Count, uncheckedItems.Count, "Unchecked items mismatched.");
Assert.IsTrue(uncheckedItems.Equals(allSensesForEntry), "Unchecked items mismatched.");
}
示例7: ExceptTest
public void ExceptTest()
{
var rnd = new Random();
var set = new Set<int>();
var first = new List<int>();
var second = new Set<int>();
var treshhold = rnd.Next(999);
for (int i = 0; i < 1000; i++)
{
set.Add(i);
if (i < treshhold)
first.Add(i);
else
second.Add(i);
}
set.ExceptWith(first);
var result = set.Equals(second);
Assert.AreEqual(true, result);
}