本文整理汇总了C#中LibGit2Sharp.Tests.TestHelpers.TemporaryCloneOfTestRepo类的典型用法代码示例。如果您正苦于以下问题:C# TemporaryCloneOfTestRepo类的具体用法?C# TemporaryCloneOfTestRepo怎么用?C# TemporaryCloneOfTestRepo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TemporaryCloneOfTestRepo类属于LibGit2Sharp.Tests.TestHelpers命名空间,在下文中一共展示了TemporaryCloneOfTestRepo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BlindlyMovingABranchOverAnExistingOneThrows
public void BlindlyMovingABranchOverAnExistingOneThrows()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
Assert.Throws<ApplicationException>(() => repo.Branches.Move("br2", "test"));
}
}
示例2: BlindlyCreatingALightweightTagOverAnExistingOneThrows
public void BlindlyCreatingALightweightTagOverAnExistingOneThrows()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
Assert.Throws<ApplicationException>(() => repo.Tags.Create("e90810b", "refs/heads/br2"));
}
}
示例3: BlindlyCreatingAnAnnotatedTagOverAnExistingOneThrows
public void BlindlyCreatingAnAnnotatedTagOverAnExistingOneThrows()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
Assert.Throws<ApplicationException>(() => repo.Tags.Create("e90810b", "refs/heads/br2", signatureNtk, "a nice message"));
}
}
示例4: BlindlyCreatingADirectReferenceOverAnExistingOneThrows
public void BlindlyCreatingADirectReferenceOverAnExistingOneThrows()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
Assert.Throws<ApplicationException>(() => repo.Refs.Create("refs/heads/master", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
}
}
示例5: BlindlyCreatingASymbolicReferenceOverAnExistingOneThrows
public void BlindlyCreatingASymbolicReferenceOverAnExistingOneThrows()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
Assert.Throws<ApplicationException>(() => repo.Refs.Create("HEAD", "refs/head/br2"));
}
}
示例6: CanCreateALightweightTagFromABranchName
public void CanCreateALightweightTagFromABranchName()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
var newTag = repo.Tags.Create("i_am_lightweight", "refs/heads/master");
newTag.IsAnnotated.ShouldBeFalse();
newTag.ShouldNotBeNull();
}
}
示例7: CanCreateALightWeightTagFromAbbreviatedSha
public void CanCreateALightWeightTagFromAbbreviatedSha()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
var newTag = repo.Tags.Create("i_am_lightweight", commitE90810BSha.Substring(0, 17));
newTag.ShouldNotBeNull();
newTag.IsAnnotated.ShouldBeFalse();
}
}
示例8: ADeletedTagCannotBeLookedUp
public void ADeletedTagCannotBeLookedUp()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
const string tagName = "e90810b";
repo.Tags.Delete(tagName);
repo.Tags[tagName].ShouldBeNull();
}
}
示例9: ADeletedReferenceCannotBeLookedUp
public void ADeletedReferenceCannotBeLookedUp()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
const string refName = "refs/heads/test";
repo.Refs.Delete(refName);
repo.Refs[refName].ShouldBeNull();
}
}
示例10: CanCreateBranchFromExplicitHead
public void CanCreateBranchFromExplicitHead()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
const string name = "unit_test";
var newBranch = repo.CreateBranch(name, "HEAD");
newBranch.ShouldNotBeNull();
newBranch.Tip.Sha.ShouldEqual("4c062a6361ae6959e06292c1fa5e2822d9c96345");
}
}
示例11: CanCheckoutAnExistingBranch
public void CanCheckoutAnExistingBranch()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
var master = repo.Branches["master"];
master.IsCurrentRepositoryHead.ShouldBeTrue();
var test = repo.Branches.Checkout("test");
test.IsCurrentRepositoryHead.ShouldBeTrue();
master.IsCurrentRepositoryHead.ShouldBeFalse();
}
}
示例12: CanCreateADirectReference
public void CanCreateADirectReference()
{
const string name = "refs/heads/unit_test";
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
var newRef = (DirectReference) repo.Refs.Create(name, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
newRef.ShouldNotBeNull();
newRef.CanonicalName.ShouldEqual(name);
newRef.Target.ShouldNotBeNull();
newRef.Target.Sha.ShouldEqual("be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
newRef.TargetIdentifier.ShouldEqual(newRef.Target.Sha);
repo.Refs[name].ShouldNotBeNull();
}
}
示例13: CanCreateBranchFromImplicitHead
public void CanCreateBranchFromImplicitHead()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
const string name = "unit_test";
var newBranch = repo.CreateBranch(name);
newBranch.ShouldNotBeNull();
newBranch.Name.ShouldEqual(name);
newBranch.CanonicalName.ShouldEqual("refs/heads/" + name);
newBranch.IsCurrentRepositoryHead.ShouldBeFalse();
newBranch.Tip.ShouldNotBeNull();
newBranch.Tip.Sha.ShouldEqual("4c062a6361ae6959e06292c1fa5e2822d9c96345");
repo.Branches.SingleOrDefault(p => p.Name == name).ShouldNotBeNull();
}
}
示例14: CanCreateBranch
public void CanCreateBranch()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
const string name = "unit_test";
var newBranch = repo.CreateBranch(name, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
newBranch.ShouldNotBeNull();
newBranch.Name.ShouldEqual(name);
newBranch.CanonicalName.ShouldEqual("refs/heads/" + name);
newBranch.Tip.ShouldNotBeNull();
newBranch.Tip.Sha.ShouldEqual("be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
repo.Branches.SingleOrDefault(p => p.Name == name).ShouldNotBeNull();
repo.Branches.Delete(newBranch.Name);
}
}
示例15: TwoBranchesPointingAtTheSameCommitAreNotBothCurrent
public void TwoBranchesPointingAtTheSameCommitAreNotBothCurrent()
{
using (var path = new TemporaryCloneOfTestRepo())
using (var repo = new Repository(path.RepositoryPath))
{
var master = repo.Branches["refs/heads/master"];
var newBranch = repo.Branches.Create("clone-of-master", master.Tip.Sha);
newBranch.IsCurrentRepositoryHead.ShouldBeFalse();
}
}