本文整理汇总了C#中RefMap.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# RefMap.isEmpty方法的具体用法?C# RefMap.isEmpty怎么用?C# RefMap.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RefMap
的用法示例。
在下文中一共展示了RefMap.isEmpty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: testEmpty_NoPrefix1
public void testEmpty_NoPrefix1()
{
RefMap map = new RefMap("", packed, loose, resolved);
Assert.IsTrue(map.isEmpty()); // before size was computed
Assert.AreEqual(0, map.size());
Assert.IsTrue(map.isEmpty()); // after size was computed
Assert.IsFalse(map.entrySet().iterator().hasNext());
Assert.IsFalse(map.keySet().iterator().hasNext());
Assert.IsFalse(map.containsKey("a"));
Assert.IsNull(map.get("a"));
}
示例2: testClear
public void testClear()
{
global::GitSharp.Core.Ref master = newRef("refs/heads/master", ID_ONE);
loose = toList(master);
RefMap map = new RefMap("", packed, loose, resolved);
Assert.AreSame(master, map.get("refs/heads/master"));
map.clear();
Assert.IsNull(map.get("refs/heads/master"));
Assert.IsTrue(map.isEmpty());
Assert.AreEqual(0, map.size());
}
示例3: testRemove
public void testRemove()
{
global::GitSharp.Core.Ref master = newRef("refs/heads/master", ID_ONE);
global::GitSharp.Core.Ref headU = newRef("HEAD", "refs/heads/master");
global::GitSharp.Core.Ref headR = newRef("HEAD", master);
packed = toList(master);
loose = toList(headU, master);
resolved = toList(headR);
RefMap map = new RefMap("", packed, loose, resolved);
Assert.IsNull(map.remove("not.a.reference"));
Assert.AreSame(master, map.remove("refs/heads/master"));
Assert.IsNull(map.get("refs/heads/master"));
Assert.AreSame(headR, map.remove("HEAD"));
Assert.IsNull(map.get("HEAD"));
Assert.IsTrue(map.isEmpty());
}
示例4: testNotEmpty_WithPrefix
public void testNotEmpty_WithPrefix()
{
global::GitSharp.Core.Ref master = newRef("refs/heads/master", ID_ONE);
packed = toList(master);
RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
Assert.IsFalse(map.isEmpty()); // before size was computed
Assert.AreEqual(1, map.size());
Assert.IsFalse(map.isEmpty()); // after size was computed
Assert.AreSame(master, map.values().iterator().next());
}
示例5: testMerge_PackedLooseLoose
public void testMerge_PackedLooseLoose()
{
global::GitSharp.Core.Ref refA = newRef("A", ID_ONE);
global::GitSharp.Core.Ref refB_ONE = newRef("B", ID_ONE);
global::GitSharp.Core.Ref refB_TWO = newRef("B", ID_TWO);
global::GitSharp.Core.Ref refc = newRef("c", ID_ONE);
packed = toList(refA, refB_ONE);
loose = toList(refB_TWO, refc);
RefMap map = new RefMap("", packed, loose, resolved);
Assert.AreEqual(3, map.size());
Assert.IsFalse(map.isEmpty());
Assert.IsTrue(map.containsKey(refA.Name));
Assert.AreSame(refA, map.get(refA.Name));
// loose overrides packed given same name
Assert.AreSame(refB_TWO, map.get(refB_ONE.Name));
var itr = map.values().iterator();
Assert.IsTrue(itr.hasNext());
Assert.AreSame(refA, itr.next());
Assert.IsTrue(itr.hasNext());
Assert.AreSame(refB_TWO, itr.next());
Assert.IsTrue(itr.hasNext());
Assert.AreSame(refc, itr.next());
Assert.IsFalse(itr.hasNext());
}
示例6: testMerge_HeadMaster
public void testMerge_HeadMaster()
{
global::GitSharp.Core.Ref master = newRef("refs/heads/master", ID_ONE);
global::GitSharp.Core.Ref headU = newRef("HEAD", "refs/heads/master");
global::GitSharp.Core.Ref headR = newRef("HEAD", master);
loose = toList(headU, master);
resolved = toList(headR);
RefMap map = new RefMap("", packed, loose, resolved);
Assert.AreEqual(2, map.size());
Assert.IsFalse(map.isEmpty());
Assert.IsTrue(map.containsKey("refs/heads/master"));
Assert.AreSame(master, map.get("refs/heads/master"));
// resolved overrides loose given same name
Assert.AreSame(headR, map.get("HEAD"));
IteratorBase<global::GitSharp.Core.Ref> itr = map.values().iterator();
Assert.IsTrue(itr.hasNext());
Assert.AreSame(headR, itr.next());
Assert.IsTrue(itr.hasNext());
Assert.AreSame(master, itr.next());
Assert.IsFalse(itr.hasNext());
}
示例7: testEmpty_WithPrefix
public void testEmpty_WithPrefix()
{
global::GitSharp.Core.Ref master = newRef("refs/heads/master", ID_ONE);
packed = toList(master);
RefMap map = new RefMap("refs/tags/", packed, loose, resolved);
Assert.IsTrue(map.isEmpty()); // before size was computed
Assert.AreEqual(0, map.size());
Assert.IsTrue(map.isEmpty()); // after size was computed
Assert.IsFalse(map.entrySet().iterator().hasNext());
Assert.IsFalse(map.keySet().iterator().hasNext());
}