本文整理汇总了C#中RefMap.EntrySet方法的典型用法代码示例。如果您正苦于以下问题:C# RefMap.EntrySet方法的具体用法?C# RefMap.EntrySet怎么用?C# RefMap.EntrySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RefMap
的用法示例。
在下文中一共展示了RefMap.EntrySet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEmpty_NoPrefix1
public virtual void TestEmpty_NoPrefix1()
{
RefMap map = new RefMap(string.Empty, packed, loose, resolved);
NUnit.Framework.Assert.IsTrue(map.IsEmpty());
// before size was computed
NUnit.Framework.Assert.AreEqual(0, map.Count);
NUnit.Framework.Assert.IsTrue(map.IsEmpty());
// after size was computed
NUnit.Framework.Assert.IsFalse(map.EntrySet().Iterator().HasNext());
NUnit.Framework.Assert.IsFalse(map.Keys.Iterator().HasNext());
NUnit.Framework.Assert.IsFalse(map.ContainsKey("a"));
NUnit.Framework.Assert.IsNull(map.Get("a"));
}
示例2: TestEntryTypeSet
public virtual void TestEntryTypeSet()
{
Ref refA_one = NewRef("refs/heads/A", ID_ONE);
Ref refA_two = NewRef("refs/heads/A", ID_TWO);
packed = ToList(refA_one);
RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
NUnit.Framework.Assert.AreSame(refA_one, map.Get("A"));
KeyValuePair<string, Ref> ent = map.EntrySet().Iterator().Next();
NUnit.Framework.Assert.AreEqual("A", ent.Key);
NUnit.Framework.Assert.AreSame(refA_one, ent.Value);
// NUnit.Framework.Assert.AreSame(refA_one, ent.SetValue(refA_two));
// NUnit.Framework.Assert.AreSame(refA_two, ent.Value);
NUnit.Framework.Assert.AreSame(refA_two, map.Get("A"));
NUnit.Framework.Assert.AreEqual(1, map.Count);
}
示例3: TestEntryType
public virtual void TestEntryType()
{
Ref a = NewRef("refs/heads/A", ID_ONE);
Ref b = NewRef("refs/heads/B", ID_TWO);
packed = ToList(a, b);
RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
Iterator<KeyValuePair<string, Ref>> itr = map.EntrySet().Iterator();
KeyValuePair<string, Ref> ent_a = itr.Next();
KeyValuePair<string, Ref> ent_b = itr.Next();
// NUnit.Framework.Assert.AreEqual(ent_a.GetHashCode(), "A".GetHashCode());
NUnit.Framework.Assert.IsTrue(ent_a.Equals(ent_a));
NUnit.Framework.Assert.IsFalse(ent_a.Equals(ent_b));
NUnit.Framework.Assert.AreEqual(a.ToString(), ent_a.ToString());
}
示例4: TestMerge_WithPrefix
public virtual void TestMerge_WithPrefix()
{
Ref a = NewRef("refs/heads/A", ID_ONE);
Ref b = NewRef("refs/heads/foo/bar/B", ID_TWO);
Ref c = NewRef("refs/heads/foo/rab/C", ID_TWO);
Ref g = NewRef("refs/heads/g", ID_ONE);
packed = ToList(a, b, c, g);
RefMap map = new RefMap("refs/heads/foo/", packed, loose, resolved);
NUnit.Framework.Assert.AreEqual(2, map.Count);
NUnit.Framework.Assert.AreSame(b, map.Get("bar/B"));
NUnit.Framework.Assert.AreSame(c, map.Get("rab/C"));
NUnit.Framework.Assert.IsNull(map.Get("refs/heads/foo/bar/B"));
NUnit.Framework.Assert.IsNull(map.Get("refs/heads/A"));
NUnit.Framework.Assert.IsTrue(map.ContainsKey("bar/B"));
NUnit.Framework.Assert.IsTrue(map.ContainsKey("rab/C"));
NUnit.Framework.Assert.IsFalse(map.ContainsKey("refs/heads/foo/bar/B"));
NUnit.Framework.Assert.IsFalse(map.ContainsKey("refs/heads/A"));
Iterator<KeyValuePair<string, Ref>> itr = map.EntrySet().Iterator();
KeyValuePair<string, Ref> ent;
NUnit.Framework.Assert.IsTrue(itr.HasNext());
ent = itr.Next();
NUnit.Framework.Assert.AreEqual("bar/B", ent.Key);
NUnit.Framework.Assert.AreSame(b, ent.Value);
NUnit.Framework.Assert.IsTrue(itr.HasNext());
ent = itr.Next();
NUnit.Framework.Assert.AreEqual("rab/C", ent.Key);
NUnit.Framework.Assert.AreSame(c, ent.Value);
NUnit.Framework.Assert.IsFalse(itr.HasNext());
}
示例5: TestEmpty_WithPrefix
public virtual void TestEmpty_WithPrefix()
{
Ref master = NewRef("refs/heads/master", ID_ONE);
packed = ToList(master);
RefMap map = new RefMap("refs/tags/", packed, loose, resolved);
NUnit.Framework.Assert.IsTrue(map.IsEmpty());
// before size was computed
NUnit.Framework.Assert.AreEqual(0, map.Count);
NUnit.Framework.Assert.IsTrue(map.IsEmpty());
// after size was computed
NUnit.Framework.Assert.IsFalse(map.EntrySet().Iterator().HasNext());
NUnit.Framework.Assert.IsFalse(map.Keys.Iterator().HasNext());
}
示例6: TestEntryTypeSet
public virtual void TestEntryTypeSet()
{
Ref refA_one = NewRef("refs/heads/A", ID_ONE);
Ref refA_two = NewRef("refs/heads/A", ID_TWO);
packed = ToList(refA_one);
RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
NUnit.Framework.Assert.AreSame(refA_one, map.Get("A"));
KeyValuePair<string, Ref> ent = map.EntrySet().Iterator().Next();
NUnit.Framework.Assert.AreEqual("A", ent.Key);
NUnit.Framework.Assert.AreSame(refA_one, ent.Value);
// FIXME: .NET returns an immutable KeyValuePair whereas Java
// returns a mutable one. Therefore this test is invalid in .NET
// No code does this internally (it's a compile error as SetValue does not exist)
// so we are ok to comment this out.
// NUnit.Framework.Assert.AreSame(refA_one, ent.SetValue(refA_two));
// NUnit.Framework.Assert.AreSame(refA_two, ent.Value);
// NUnit.Framework.Assert.AreEqual(refA_two, map.Get("A"));
// NUnit.Framework.Assert.AreEqual(1, map.Count);
}