本文整理汇总了C#中RefMap.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# RefMap.ContainsKey方法的具体用法?C# RefMap.ContainsKey怎么用?C# RefMap.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RefMap
的用法示例。
在下文中一共展示了RefMap.ContainsKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEmpty_NoPrefix2
public virtual void TestEmpty_NoPrefix2()
{
RefMap map = new RefMap();
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: TestMerge_PackedLooseLoose
public virtual void TestMerge_PackedLooseLoose()
{
Ref refA = NewRef("A", ID_ONE);
Ref refB_ONE = NewRef("B", ID_ONE);
Ref refB_TWO = NewRef("B", ID_TWO);
Ref refc = NewRef("c", ID_ONE);
packed = ToList(refA, refB_ONE);
loose = ToList(refB_TWO, refc);
RefMap map = new RefMap(string.Empty, packed, loose, resolved);
NUnit.Framework.Assert.AreEqual(3, map.Count);
NUnit.Framework.Assert.IsFalse(map.IsEmpty());
NUnit.Framework.Assert.IsTrue(map.ContainsKey(refA.GetName()));
NUnit.Framework.Assert.AreSame(refA, map.Get(refA.GetName()));
// loose overrides packed given same name
NUnit.Framework.Assert.AreSame(refB_TWO, map.Get(refB_ONE.GetName()));
Iterator<Ref> itr = map.Values.Iterator();
NUnit.Framework.Assert.IsTrue(itr.HasNext());
NUnit.Framework.Assert.AreSame(refA, itr.Next());
NUnit.Framework.Assert.IsTrue(itr.HasNext());
NUnit.Framework.Assert.AreSame(refB_TWO, itr.Next());
NUnit.Framework.Assert.IsTrue(itr.HasNext());
NUnit.Framework.Assert.AreSame(refc, itr.Next());
NUnit.Framework.Assert.IsFalse(itr.HasNext());
}
示例3: 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());
}
示例4: TestMerge_HeadMaster
public virtual void TestMerge_HeadMaster()
{
Ref master = NewRef("refs/heads/master", ID_ONE);
Ref headU = NewRef("HEAD", "refs/heads/master");
Ref headR = NewRef("HEAD", master);
loose = ToList(headU, master);
resolved = ToList(headR);
RefMap map = new RefMap(string.Empty, packed, loose, resolved);
NUnit.Framework.Assert.AreEqual(2, map.Count);
NUnit.Framework.Assert.IsFalse(map.IsEmpty());
NUnit.Framework.Assert.IsTrue(map.ContainsKey("refs/heads/master"));
NUnit.Framework.Assert.AreSame(master, map.Get("refs/heads/master"));
// resolved overrides loose given same name
NUnit.Framework.Assert.AreSame(headR, map.Get("HEAD"));
Iterator<Ref> itr = map.Values.Iterator();
NUnit.Framework.Assert.IsTrue(itr.HasNext());
NUnit.Framework.Assert.AreSame(headR, itr.Next());
NUnit.Framework.Assert.IsTrue(itr.HasNext());
NUnit.Framework.Assert.AreSame(master, itr.Next());
NUnit.Framework.Assert.IsFalse(itr.HasNext());
}