本文整理汇总了C#中RefMap.IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# RefMap.IsEmpty方法的具体用法?C# RefMap.IsEmpty怎么用?C# RefMap.IsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RefMap
的用法示例。
在下文中一共展示了RefMap.IsEmpty方法的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: TestRemove
public virtual void TestRemove()
{
Ref master = NewRef("refs/heads/master", ID_ONE);
Ref headU = NewRef("HEAD", "refs/heads/master");
Ref headR = NewRef("HEAD", master);
packed = ToList(master);
loose = ToList(headU, master);
resolved = ToList(headR);
RefMap map = new RefMap(string.Empty, packed, loose, resolved);
NUnit.Framework.Assert.IsNull(Sharpen.Collections.Remove(map, "not.a.reference"));
NUnit.Framework.Assert.AreSame(master, Sharpen.Collections.Remove(map, "refs/heads/master"
));
NUnit.Framework.Assert.IsNull(map.Get("refs/heads/master"));
NUnit.Framework.Assert.AreSame(headR, Sharpen.Collections.Remove(map, "HEAD"));
NUnit.Framework.Assert.IsNull(map.Get("HEAD"));
NUnit.Framework.Assert.IsTrue(map.IsEmpty());
}
示例3: 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());
}
示例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());
}
示例5: TestClear
public virtual void TestClear()
{
Ref master = NewRef("refs/heads/master", ID_ONE);
loose = ToList(master);
RefMap map = new RefMap(string.Empty, packed, loose, resolved);
NUnit.Framework.Assert.AreSame(master, map.Get("refs/heads/master"));
map.Clear();
NUnit.Framework.Assert.IsNull(map.Get("refs/heads/master"));
NUnit.Framework.Assert.IsTrue(map.IsEmpty());
NUnit.Framework.Assert.AreEqual(0, map.Count);
}
示例6: TestNotEmpty_WithPrefix
public virtual void TestNotEmpty_WithPrefix()
{
Ref master = NewRef("refs/heads/master", ID_ONE);
packed = ToList(master);
RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
NUnit.Framework.Assert.IsFalse(map.IsEmpty());
// before size was computed
NUnit.Framework.Assert.AreEqual(1, map.Count);
NUnit.Framework.Assert.IsFalse(map.IsEmpty());
// after size was computed
NUnit.Framework.Assert.AreSame(master, map.Values.Iterator().Next());
}