本文整理汇总了C#中RefMap.Put方法的典型用法代码示例。如果您正苦于以下问题:C# RefMap.Put方法的具体用法?C# RefMap.Put怎么用?C# RefMap.Put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RefMap
的用法示例。
在下文中一共展示了RefMap.Put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestPut_WithPrefix
public virtual void TestPut_WithPrefix()
{
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"));
NUnit.Framework.Assert.AreSame(refA_one, map.Put("A", refA_two));
// map changed, but packed, loose did not
NUnit.Framework.Assert.AreSame(refA_two, map.Get("A"));
NUnit.Framework.Assert.AreSame(refA_one, packed.Get(0));
NUnit.Framework.Assert.AreEqual(0, loose.Size());
NUnit.Framework.Assert.AreSame(refA_two, map.Put("A", refA_one));
NUnit.Framework.Assert.AreSame(refA_one, map.Get("A"));
}
示例2: TestPut_CollapseResolved
public virtual void TestPut_CollapseResolved()
{
Ref master = NewRef("refs/heads/master", ID_ONE);
Ref headU = NewRef("HEAD", "refs/heads/master");
Ref headR = NewRef("HEAD", master);
Ref a = NewRef("refs/heads/A", ID_ONE);
loose = ToList(headU, master);
resolved = ToList(headR);
RefMap map = new RefMap(string.Empty, packed, loose, resolved);
NUnit.Framework.Assert.IsNull(map.Put(a.GetName(), a));
NUnit.Framework.Assert.AreSame(a, map.Get(a.GetName()));
NUnit.Framework.Assert.AreSame(headR, map.Get("HEAD"));
}
示例3: TestPut_KeyMustMatchName_WithPrefix
public virtual void TestPut_KeyMustMatchName_WithPrefix()
{
Ref refA = NewRef("refs/heads/A", ID_ONE);
RefMap map = new RefMap("refs/heads/", packed, loose, resolved);
try
{
map.Put("FOO", refA);
NUnit.Framework.Assert.Fail("map accepted invalid key/value pair");
}
catch (ArgumentException)
{
}
}