diff options
author | nulltoken <emeric.fermas@gmail.com> | 2011-06-18 20:37:54 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2011-06-18 20:37:54 +0400 |
commit | 99eace9a67b33ae9f4c621b82d059e6c58e1c3a9 (patch) | |
tree | a49f4af40e26e3d656b9e6e7c2bec70a5d2b3256 | |
parent | d1dea3dcdf8d04387bb96b1fb3f72a00fcbb98d3 (diff) |
Made name of some test constants more explicit
-rwxr-xr-x | LibGit2Sharp.Tests/BlobFixture.cs | 10 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/BranchFixture.cs | 24 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/CommitFixture.cs | 30 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/IndexFixture.cs | 24 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/ReferenceFixture.cs | 34 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/RepositoryFixture.cs | 46 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/TagFixture.cs | 32 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs | 4 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/TestHelpers/Constants.cs | 6 | ||||
-rw-r--r-- | LibGit2Sharp.Tests/TestHelpers/TemporaryCloneOfTestRepo.cs | 2 | ||||
-rwxr-xr-x | LibGit2Sharp.Tests/TreeFixture.cs | 22 |
11 files changed, 117 insertions, 117 deletions
diff --git a/LibGit2Sharp.Tests/BlobFixture.cs b/LibGit2Sharp.Tests/BlobFixture.cs index 6fdadb9a..724c5d8e 100755 --- a/LibGit2Sharp.Tests/BlobFixture.cs +++ b/LibGit2Sharp.Tests/BlobFixture.cs @@ -11,7 +11,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanGetBlobAsUtf8()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
@@ -23,7 +23,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanGetBlobSize()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
blob.Size.ShouldEqual(10);
@@ -33,7 +33,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanLookUpBlob()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
blob.ShouldNotBeNull();
@@ -43,7 +43,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanReadBlobContent()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
var bytes = blob.Content;
@@ -57,7 +57,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanReadBlobStream()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var blob = repo.Lookup<Blob>("a8233120f6ad708f843d861ce2b7228ec4e3dec6");
diff --git a/LibGit2Sharp.Tests/BranchFixture.cs b/LibGit2Sharp.Tests/BranchFixture.cs index 70c1bd88..dbdbbf75 100644 --- a/LibGit2Sharp.Tests/BranchFixture.cs +++ b/LibGit2Sharp.Tests/BranchFixture.cs @@ -81,7 +81,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanListAllBranches() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { foreach (var r in repo.Branches) { @@ -95,7 +95,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanLookupABranchByItsCanonicalName() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var branch = repo.Branches["refs/heads/br2"]; branch.ShouldNotBeNull(); @@ -113,7 +113,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanLookupLocalBranch() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var master = repo.Branches["master"]; master.ShouldNotBeNull(); @@ -128,7 +128,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanWalkCommitsFromAnotherBranch() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var master = repo.Branches["test"]; master.Commits.Count().ShouldEqual(2); @@ -138,7 +138,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanWalkCommitsFromBranch() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var master = repo.Branches["master"]; master.Commits.Count().ShouldEqual(7); @@ -159,7 +159,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreatingBranchWithEmptyNameThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Branches.Create(string.Empty, repo.Head.CanonicalName)); } @@ -169,7 +169,7 @@ namespace LibGit2Sharp.Tests [Ignore("Not implemented yet.")] public void CreatingBranchWithUnknownNamedTargetThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Branches.Create("my_new_branch", "my_old_branch")); } @@ -178,7 +178,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreatingBranchWithUnknownShaTargetThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ApplicationException>(() => repo.Branches.Create("my_new_branch", Constants.UnknownSha)); } @@ -187,7 +187,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreatingBranchWithEmptyTargetThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Branches.Create("bad_branch", string.Empty)); } @@ -196,7 +196,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreatingBranchWithNullNameThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => repo.Branches.Create(null, repo.Head.CanonicalName)); } @@ -205,7 +205,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreatingBranchWithNullTargetThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => repo.Branches.Create("bad_branch", null)); } @@ -225,7 +225,7 @@ namespace LibGit2Sharp.Tests [Test] public void OnlyOneBranchIsTheHead() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Branch head = null; diff --git a/LibGit2Sharp.Tests/CommitFixture.cs b/LibGit2Sharp.Tests/CommitFixture.cs index d475f8f6..e21c8d1e 100644 --- a/LibGit2Sharp.Tests/CommitFixture.cs +++ b/LibGit2Sharp.Tests/CommitFixture.cs @@ -17,7 +17,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanCountCommits()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
repo.Commits.Count().ShouldEqual(7);
}
@@ -26,7 +26,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanCorrectlyCountCommitsWhenSwitchingToAnotherBranch()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
repo.Branches.Checkout("test");
repo.Commits.Count().ShouldEqual(2);
@@ -42,7 +42,7 @@ namespace LibGit2Sharp.Tests public void CanEnumerateCommits()
{
int count = 0;
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
foreach (var commit in repo.Commits)
{
@@ -56,7 +56,7 @@ namespace LibGit2Sharp.Tests [Test]
public void DefaultOrderingWhenEnumeratingCommitsIsTimeBased()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
repo.Commits.SortedBy.ShouldEqual(GitSortOptions.Time);
}
@@ -66,7 +66,7 @@ namespace LibGit2Sharp.Tests public void CanEnumerateCommitsFromSha()
{
int count = 0;
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
foreach (var commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" }))
{
@@ -80,7 +80,7 @@ namespace LibGit2Sharp.Tests [Test]
public void QueryingTheCommitHistoryWithUnknownShaOrInvalidReferenceThrows()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
Assert.Throws<InvalidOperationException>(() => repo.Commits.QueryBy(new Filter { Since = Constants.UnknownSha}).Count());
Assert.Throws<InvalidOperationException>(() => repo.Commits.QueryBy(new Filter { Since = "refs/heads/deadbeef"}).Count());
@@ -92,7 +92,7 @@ namespace LibGit2Sharp.Tests [Test]
public void QueryingTheCommitHistoryWithBadParamsThrows()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
Assert.Throws<ArgumentException>(() => repo.Commits.QueryBy(new Filter { Since = string.Empty }));
Assert.Throws<ArgumentNullException>(() => repo.Commits.QueryBy(new Filter { Since = null }));
@@ -105,7 +105,7 @@ namespace LibGit2Sharp.Tests {
expectedShas.Reverse();
int count = 0;
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
foreach (var commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time | GitSortOptions.Reverse }))
{
@@ -120,7 +120,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanEnumerateCommitsWithReverseTopoSorting()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var commits = repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time | GitSortOptions.Reverse }).ToList();
foreach (var commit in commits)
@@ -139,7 +139,7 @@ namespace LibGit2Sharp.Tests public void CanEnumerateCommitsWithTimeSorting()
{
int count = 0;
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
foreach (var commit in repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Time }))
{
@@ -154,7 +154,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanEnumerateCommitsWithTopoSorting()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var commits = repo.Commits.QueryBy(new Filter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = GitSortOptions.Topological }).ToList();
foreach (var commit in commits)
@@ -172,7 +172,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanEnumerateUsingTwoCommitsAsBoundaries()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var commits = repo.Commits.QueryBy(new Filter { Since = "refs/heads/br2", Until = "refs/heads/packed-test" });
@@ -184,7 +184,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanLookupCommitGeneric()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var commit = repo.Lookup<Commit>(sha);
commit.Message.ShouldEqual("testing\n");
@@ -196,7 +196,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanReadCommitData()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var obj = repo.Lookup(sha);
obj.ShouldNotBeNull();
@@ -226,7 +226,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanReadCommitWithMultipleParents()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var commit = repo.Lookup<Commit>("a4a7dce85cf63874e984719f4fdd239f5145052f");
commit.Parents.Count().ShouldEqual(2);
diff --git a/LibGit2Sharp.Tests/IndexFixture.cs b/LibGit2Sharp.Tests/IndexFixture.cs index b17c41d2..6a337ece 100644 --- a/LibGit2Sharp.Tests/IndexFixture.cs +++ b/LibGit2Sharp.Tests/IndexFixture.cs @@ -27,7 +27,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanCountEntriesInIndex() { - using (var repo = new Repository(Constants.TestRepoWithWorkingDirPath)) + using (var repo = new Repository(Constants.StandardTestRepoPath)) { repo.Index.Count.ShouldEqual(expectedEntries.Count); } @@ -36,7 +36,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanEnumerateIndex() { - using (var repo = new Repository(Constants.TestRepoWithWorkingDirPath)) + using (var repo = new Repository(Constants.StandardTestRepoPath)) { foreach (var entry in repo.Index) { @@ -66,7 +66,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanReadIndexEntry() { - using (var repo = new Repository(Constants.TestRepoWithWorkingDirPath)) + using (var repo = new Repository(Constants.StandardTestRepoPath)) { var entry = repo.Index["README"]; entry.Path.ShouldEqual("README"); @@ -85,7 +85,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanStageANewFile() { - using (var path = new TemporaryCloneOfTestRepo(Constants.TestRepoWithWorkingDirRootPath)) + using (var path = new TemporaryCloneOfTestRepo(Constants.StandardTestRepoWorkingDirPath)) using (var repo = new Repository(path.RepositoryPath)) { var count = repo.Index.Count; @@ -102,7 +102,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanStageANewFileInAPersistentManner() { - using (var path = new TemporaryCloneOfTestRepo(Constants.TestRepoWithWorkingDirPath)) + using (var path = new TemporaryCloneOfTestRepo(Constants.StandardTestRepoPath)) { using (var repo = new Repository(path.RepositoryPath)) { @@ -124,7 +124,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanStageANewFileWithAFullPath() { - using (var path = new TemporaryCloneOfTestRepo(Constants.TestRepoWithWorkingDirRootPath)) + using (var path = new TemporaryCloneOfTestRepo(Constants.StandardTestRepoWorkingDirPath)) using (var repo = new Repository(path.RepositoryPath)) { var count = repo.Index.Count; @@ -144,7 +144,7 @@ namespace LibGit2Sharp.Tests public void StagingANewFileWithAFullPathWhichEscapesOutOfTheWorkingDirThrows() { using (var scd = new SelfCleaningDirectory()) - using (var path = new TemporaryCloneOfTestRepo(Constants.TestRepoWithWorkingDirRootPath)) + using (var path = new TemporaryCloneOfTestRepo(Constants.StandardTestRepoWorkingDirPath)) using (var repo = new Repository(path.RepositoryPath)) { var di = Directory.CreateDirectory(scd.DirectoryPath); @@ -211,7 +211,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanUnstageANewFile() { - using (var path = new TemporaryCloneOfTestRepo(Constants.TestRepoWithWorkingDirRootPath)) + using (var path = new TemporaryCloneOfTestRepo(Constants.StandardTestRepoWorkingDirPath)) using (var repo = new Repository(path.RepositoryPath)) { var count = repo.Index.Count; @@ -231,7 +231,7 @@ namespace LibGit2Sharp.Tests [Test] public void UnstagingANonStagedFileThrows() { - using (var repo = new Repository(Constants.TestRepoWithWorkingDirPath)) + using (var repo = new Repository(Constants.StandardTestRepoPath)) { Assert.Throws<ApplicationException>(() => repo.Index.Unstage("shadowcopy_of_a_unseen_ghost.txt")); } @@ -246,7 +246,7 @@ namespace LibGit2Sharp.Tests [Test] public void ReadIndexWithBadParamsFails() { - using (var repo = new Repository(Constants.TestRepoWithWorkingDirPath)) + using (var repo = new Repository(Constants.StandardTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => { var entry = repo.Index[null]; }); Assert.Throws<ArgumentException>(() => { var entry = repo.Index[string.Empty]; }); @@ -256,7 +256,7 @@ namespace LibGit2Sharp.Tests [Test] public void StageFileWithBadParamsThrows() { - using (var repo = new Repository(Constants.TestRepoWithWorkingDirPath)) + using (var repo = new Repository(Constants.StandardTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Index.Stage(string.Empty)); Assert.Throws<ArgumentNullException>(() => repo.Index.Stage(null)); @@ -266,7 +266,7 @@ namespace LibGit2Sharp.Tests [Test] public void UnstagingFileWithBadParamsThrows() { - using (var repo = new Repository(Constants.TestRepoWithWorkingDirPath)) + using (var repo = new Repository(Constants.StandardTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Index.Stage(string.Empty)); Assert.Throws<ArgumentNullException>(() => repo.Index.Stage(null)); diff --git a/LibGit2Sharp.Tests/ReferenceFixture.cs b/LibGit2Sharp.Tests/ReferenceFixture.cs index dd5fed21..436d622d 100644 --- a/LibGit2Sharp.Tests/ReferenceFixture.cs +++ b/LibGit2Sharp.Tests/ReferenceFixture.cs @@ -108,7 +108,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateWithEmptyStringForTargetThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Refs.Create("refs/heads/newref", string.Empty)); } @@ -117,7 +117,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateWithEmptyStringThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Refs.Create(string.Empty, "refs/heads/master")); } @@ -126,7 +126,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateWithNullForTargetThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => repo.Refs.Create("refs/heads/newref", null)); } @@ -135,7 +135,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateWithNullStringThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => repo.Refs.Create(null, "refs/heads/master")); } @@ -187,7 +187,7 @@ namespace LibGit2Sharp.Tests [Test] public void DeleteWithEmptyNameThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Refs.Delete(string.Empty)); } @@ -196,7 +196,7 @@ namespace LibGit2Sharp.Tests [Test] public void DeleteWithNullNameThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => repo.Refs.Delete(null)); } @@ -205,7 +205,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanListAllReferences() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { foreach (var r in repo.Refs) { @@ -219,7 +219,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanResolveHeadByName() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var head = (SymbolicReference) repo.Refs["HEAD"]; head.ShouldNotBeNull(); @@ -240,7 +240,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanResolveReferenceToALightweightTag() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var lwTag = (DirectReference) repo.Refs["refs/tags/lw"]; lwTag.ShouldNotBeNull(); @@ -254,7 +254,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanResolveReferenceToAnAnnotatedTag() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var annTag = (DirectReference) repo.Refs["refs/tags/test"]; annTag.ShouldNotBeNull(); @@ -268,7 +268,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanResolveRefsByName() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var master = (DirectReference) repo.Refs["refs/heads/master"]; master.ShouldNotBeNull(); @@ -282,7 +282,7 @@ namespace LibGit2Sharp.Tests [Test] public void ResolvingWithEmptyStringThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => { var head = repo.Refs[string.Empty]; }); } @@ -291,7 +291,7 @@ namespace LibGit2Sharp.Tests [Test] public void ResolvingWithNullThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => { var head = repo.Refs[null]; }); } @@ -357,7 +357,7 @@ namespace LibGit2Sharp.Tests public void UpdatingASymbolicRefWithOidFails() { const string masterRef = "refs/heads/master"; - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Refs.UpdateTarget(masterRef, "refs/heads/test")); } @@ -366,7 +366,7 @@ namespace LibGit2Sharp.Tests [Test] public void UpdatingAReferenceTargetWithBadParametersFails() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Refs.UpdateTarget(string.Empty, "refs/heads/packed")); Assert.Throws<ArgumentException>(() => repo.Refs.UpdateTarget("master", string.Empty)); @@ -424,7 +424,7 @@ namespace LibGit2Sharp.Tests [Test] public void MovingANonExistingReferenceThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ApplicationException>(() => repo.Refs.Move("refs/tags/i-am-void", "refs/atic/tagtest")); } @@ -449,7 +449,7 @@ namespace LibGit2Sharp.Tests [Test] public void BlindlyOverwritingAExistingReferenceThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ApplicationException>(() => repo.Refs.Move("refs/heads/packed", "refs/heads/br2")); } diff --git a/LibGit2Sharp.Tests/RepositoryFixture.cs b/LibGit2Sharp.Tests/RepositoryFixture.cs index 06146a06..47eb19a0 100644 --- a/LibGit2Sharp.Tests/RepositoryFixture.cs +++ b/LibGit2Sharp.Tests/RepositoryFixture.cs @@ -86,7 +86,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanLookupACommitByTheNameOfABranch() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var gitObject = repo.Lookup("refs/heads/master"); gitObject.ShouldNotBeNull(); @@ -97,7 +97,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanLookupACommitByTheNameOfALightweightTag() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var gitObject = repo.Lookup("refs/tags/lw"); gitObject.ShouldNotBeNull(); @@ -108,7 +108,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanLookupATagAnnotationByTheNameOfAnAnnotatedTag() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var gitObject = repo.Lookup("refs/tags/e90810b"); gitObject.ShouldNotBeNull(); @@ -119,7 +119,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanLookupObjects() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { repo.Lookup(commitSha).ShouldNotBeNull(); repo.Lookup<Commit>(commitSha).ShouldNotBeNull(); @@ -130,7 +130,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanLookupSameObjectTwiceAndTheyAreEqual() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var commit = repo.Lookup(commitSha); var commit2 = repo.Lookup(commitSha); @@ -142,7 +142,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanOpenRepoWithFullPath() { - var path = Path.GetFullPath(Constants.TestRepoPath); + var path = Path.GetFullPath(Constants.BareTestRepoPath); using (new Repository(path)) { } @@ -151,7 +151,7 @@ namespace LibGit2Sharp.Tests [Test] public void LookupObjectByWrongShaReturnsNull() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { repo.Lookup(Constants.UnknownSha).ShouldBeNull(); repo.Lookup<GitObject>(Constants.UnknownSha).ShouldBeNull(); @@ -161,7 +161,7 @@ namespace LibGit2Sharp.Tests [Test] public void LookupObjectByWrongTypeReturnsNull() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { repo.Lookup(commitSha).ShouldNotBeNull(); repo.Lookup<Commit>(commitSha).ShouldNotBeNull(); @@ -172,7 +172,7 @@ namespace LibGit2Sharp.Tests [Test] public void LookupObjectByUnknownReferenceNameReturnsNull() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { repo.Lookup("refs/heads/chopped/off").ShouldBeNull(); repo.Lookup<GitObject>(Constants.UnknownSha).ShouldBeNull(); @@ -182,7 +182,7 @@ namespace LibGit2Sharp.Tests [Test] public void LookingUpWithBadParamsThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Lookup(string.Empty)); Assert.Throws<ArgumentException>(() => repo.Lookup<GitObject>(string.Empty)); @@ -206,7 +206,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanOpenRepository() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { repo.Info.Path.ShouldNotBeNull(); repo.Info.WorkingDirectory.ShouldBeNull(); @@ -232,7 +232,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanTellIfObjectsExistInRepository() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { repo.HasObject("8496071c1b46c854b31185ea97743be6a8774479").ShouldBeTrue(); repo.HasObject("1385f264afb75a56a5bec74243be9b367ba4ca08").ShouldBeTrue(); @@ -244,7 +244,7 @@ namespace LibGit2Sharp.Tests [Test] public void CheckingForObjectExistenceWithBadParamsThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.HasObject(string.Empty)); Assert.Throws<ArgumentNullException>(() => repo.HasObject(null)); @@ -254,36 +254,36 @@ namespace LibGit2Sharp.Tests [Test] public void CanDiscoverABareRepoGivenTheRepoPath() { - string path = Repository.Discover(Constants.TestRepoPath); - path.ShouldEqual(Path.GetFullPath(Constants.TestRepoPath)); + string path = Repository.Discover(Constants.BareTestRepoPath); + path.ShouldEqual(Path.GetFullPath(Constants.BareTestRepoPath)); } [Test] public void CanDiscoverABareRepoGivenASubDirectoryOfTheRepoPath() { - string path = Repository.Discover(Path.Combine(Constants.TestRepoPath, "objects/4a")); - path.ShouldEqual(Path.GetFullPath(Constants.TestRepoPath)); + string path = Repository.Discover(Path.Combine(Constants.BareTestRepoPath, "objects/4a")); + path.ShouldEqual(Path.GetFullPath(Constants.BareTestRepoPath)); } [Test] public void CanDiscoverAStandardRepoGivenTheRepoPath() { - string path = Repository.Discover(Constants.TestRepoWithWorkingDirPath); - path.ShouldEqual(Path.GetFullPath(Constants.TestRepoWithWorkingDirPath)); + string path = Repository.Discover(Constants.StandardTestRepoPath); + path.ShouldEqual(Path.GetFullPath(Constants.StandardTestRepoPath)); } [Test] public void CanDiscoverAStandardRepoGivenASubDirectoryOfTheRepoPath() { - string path = Repository.Discover(Path.Combine(Constants.TestRepoWithWorkingDirPath, "objects/4a")); - path.ShouldEqual(Path.GetFullPath(Constants.TestRepoWithWorkingDirPath)); + string path = Repository.Discover(Path.Combine(Constants.StandardTestRepoPath, "objects/4a")); + path.ShouldEqual(Path.GetFullPath(Constants.StandardTestRepoPath)); } [Test] public void CanDiscoverAStandardRepoGivenTheWorkingDirPath() { - string path = Repository.Discover(Constants.TestRepoWithWorkingDirRootPath); - path.ShouldEqual(Path.GetFullPath(Constants.TestRepoWithWorkingDirPath)); + string path = Repository.Discover(Constants.StandardTestRepoWorkingDirPath); + path.ShouldEqual(Path.GetFullPath(Constants.StandardTestRepoPath)); } } }
\ No newline at end of file diff --git a/LibGit2Sharp.Tests/TagFixture.cs b/LibGit2Sharp.Tests/TagFixture.cs index 290dae2f..81f13f98 100644 --- a/LibGit2Sharp.Tests/TagFixture.cs +++ b/LibGit2Sharp.Tests/TagFixture.cs @@ -367,7 +367,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateTagWithADuplicateNameThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ApplicationException>(() => repo.Tags.Create("test", tagTestSha, signatureTim, "message")); } @@ -376,7 +376,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateTagWithEmptyNameThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Tags.Create(string.Empty, "refs/heads/master", signatureTim, "message")); } @@ -385,7 +385,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateTagWithEmptyTargetThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => repo.Tags.Create("test_tag", string.Empty, signatureTim, "message")); } @@ -394,7 +394,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateTagWithNotExistingTargetThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ApplicationException>(() => repo.Tags.Create("test_tag", Constants.UnknownSha, signatureTim, "message")); } @@ -403,7 +403,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateTagWithNullMessageThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => repo.Tags.Create("test_tag", "refs/heads/master", signatureTim, null)); } @@ -412,7 +412,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateTagWithNullNameThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => repo.Tags.Create(null, "refs/heads/master", signatureTim, "message")); } @@ -421,7 +421,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateTagWithNullSignatureThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => repo.Tags.Create("test_tag", "refs/heads/master", null, "message")); } @@ -430,7 +430,7 @@ namespace LibGit2Sharp.Tests [Test] public void CreateTagWithNullTargetThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => repo.Tags.Create("test_tag", null, signatureTim, "message")); } @@ -494,7 +494,7 @@ namespace LibGit2Sharp.Tests [Description("Ported from cgit (https://github.com/git/git/blob/1c08bf50cfcf924094eca56c2486a90e2bf1e6e2/t/t7004-tag.sh#L108)")] public void DeletingAnUnknownTagShouldFail() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ApplicationException>(() => repo.Tags.Delete("unknown-tag")); } @@ -503,7 +503,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanListTags() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { foreach (var tag in repo.Tags) { @@ -533,7 +533,7 @@ namespace LibGit2Sharp.Tests [Description("Ported from cgit (https://github.com/git/git/blob/1c08bf50cfcf924094eca56c2486a90e2bf1e6e2/t/t7004-tag.sh#L165)")] public void ListAllTagsShouldOutputThemInAnOrderedWay() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { List<string> tagNames = repo.Tags.Select(t => t.Name).ToList(); @@ -547,7 +547,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanLookupALightweightTag() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var tag = repo.Tags["lw"]; tag.ShouldNotBeNull(); @@ -562,7 +562,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanLookupATagByItsCanonicalName() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var tag = repo.Tags["refs/tags/lw"]; tag.ShouldNotBeNull(); @@ -580,7 +580,7 @@ namespace LibGit2Sharp.Tests [Test] public void CanLookupAnAnnotatedTag() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { var tag = repo.Tags["e90810b"]; tag.ShouldNotBeNull(); @@ -600,7 +600,7 @@ namespace LibGit2Sharp.Tests [Test] public void LookupEmptyTagNameThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentException>(() => { var t = repo.Tags[string.Empty]; }); } @@ -609,7 +609,7 @@ namespace LibGit2Sharp.Tests [Test] public void LookupNullTagNameThrows() { - using (var repo = new Repository(Constants.TestRepoPath)) + using (var repo = new Repository(Constants.BareTestRepoPath)) { Assert.Throws<ArgumentNullException>(() => { var t = repo.Tags[null]; }); } diff --git a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs index e161ff49..3e9a89cd 100644 --- a/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs +++ b/LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs @@ -25,8 +25,8 @@ namespace LibGit2Sharp.Tests.TestHelpers // The test repo under source control has its .git folder renamed to dot_git to avoid confusing git, // so we need to rename it back to .git in our copy under the target folder - string tempDotGit = Path.Combine(Constants.TestRepoWithWorkingDirRootPath, "dot_git"); - Directory.Move(tempDotGit, Constants.TestRepoWithWorkingDirPath); + string tempDotGit = Path.Combine(Constants.StandardTestRepoWorkingDirPath, "dot_git"); + Directory.Move(tempDotGit, Constants.StandardTestRepoPath); } } } diff --git a/LibGit2Sharp.Tests/TestHelpers/Constants.cs b/LibGit2Sharp.Tests/TestHelpers/Constants.cs index 2fca5ae6..befa6184 100644 --- a/LibGit2Sharp.Tests/TestHelpers/Constants.cs +++ b/LibGit2Sharp.Tests/TestHelpers/Constants.cs @@ -4,9 +4,9 @@ namespace LibGit2Sharp.Tests.TestHelpers { public static class Constants { - public const string TestRepoPath = "./Resources/testrepo.git"; - public const string TestRepoWithWorkingDirRootPath = "./Resources/testrepo_wd"; - public const string TestRepoWithWorkingDirPath = TestRepoWithWorkingDirRootPath + "/.git"; + public const string BareTestRepoPath = "./Resources/testrepo.git"; + public const string StandardTestRepoWorkingDirPath = "./Resources/testrepo_wd"; + public const string StandardTestRepoPath = StandardTestRepoWorkingDirPath + "/.git"; public const string TemporaryReposPath = "TestRepos"; public const string UnknownSha = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"; public static readonly Signature Signature = new Signature("A. U. Thor", "thor@valhalla.asgard.com", new DateTimeOffset(2011, 06, 16, 10, 58, 27, TimeSpan.FromHours(2))); diff --git a/LibGit2Sharp.Tests/TestHelpers/TemporaryCloneOfTestRepo.cs b/LibGit2Sharp.Tests/TestHelpers/TemporaryCloneOfTestRepo.cs index 1c411b92..eb6c5425 100644 --- a/LibGit2Sharp.Tests/TestHelpers/TemporaryCloneOfTestRepo.cs +++ b/LibGit2Sharp.Tests/TestHelpers/TemporaryCloneOfTestRepo.cs @@ -4,7 +4,7 @@ namespace LibGit2Sharp.Tests.TestHelpers { public class TemporaryCloneOfTestRepo : SelfCleaningDirectory { - public TemporaryCloneOfTestRepo(string sourceDirectoryPath = Constants.TestRepoPath) + public TemporaryCloneOfTestRepo(string sourceDirectoryPath = Constants.BareTestRepoPath) { var source = new DirectoryInfo(sourceDirectoryPath); diff --git a/LibGit2Sharp.Tests/TreeFixture.cs b/LibGit2Sharp.Tests/TreeFixture.cs index 966e55bf..59f76a59 100755 --- a/LibGit2Sharp.Tests/TreeFixture.cs +++ b/LibGit2Sharp.Tests/TreeFixture.cs @@ -12,7 +12,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanCompareTwoTreeEntries()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
TreeEntry treeEntry1 = tree["README"];
@@ -25,7 +25,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanConvertEntryToBlob()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
TreeEntry treeEntry = tree["README"];
@@ -38,7 +38,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanConvertEntryToTree()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
TreeEntry treeEntry = tree["1"];
@@ -51,7 +51,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanEnumerateBlobs()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
tree.Files.Count().ShouldEqual(3);
@@ -61,7 +61,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanEnumerateSubTrees()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
tree.Trees.Count().ShouldEqual(1);
@@ -71,7 +71,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanEnumerateTreeEntries()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
tree.Count().ShouldEqual(tree.Count);
@@ -83,7 +83,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanGetEntryByName()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
TreeEntry treeEntry = tree["README"];
@@ -95,7 +95,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanGetEntryCountFromTree()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
tree.Count.ShouldEqual(4);
@@ -105,7 +105,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanReadEntryAttributes()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
tree["README"].Attributes.ShouldEqual(33188);
@@ -115,7 +115,7 @@ namespace LibGit2Sharp.Tests [Test]
public void CanReadTheTreeData()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup<Tree>(sha);
tree.ShouldNotBeNull();
@@ -125,7 +125,7 @@ namespace LibGit2Sharp.Tests [Test]
public void TreeDataIsPresent()
{
- using (var repo = new Repository(Constants.TestRepoPath))
+ using (var repo = new Repository(Constants.BareTestRepoPath))
{
var tree = repo.Lookup(sha);
tree.ShouldNotBeNull();
|