diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-02-28 18:43:05 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-02-28 22:49:12 +0400 |
commit | 3e9348985d071912f0dfca41ea03251fe74093ef (patch) | |
tree | 8f9568ef4f5dcc204cdb39c5397443c9227065b8 /LibGit2Sharp.Tests/RepositoryFixture.cs | |
parent | 8da9472dc250d879d8cfae029cd8ee395edc9469 (diff) |
Migrate unit tests to XUnit
Diffstat (limited to 'LibGit2Sharp.Tests/RepositoryFixture.cs')
-rw-r--r-- | LibGit2Sharp.Tests/RepositoryFixture.cs | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/LibGit2Sharp.Tests/RepositoryFixture.cs b/LibGit2Sharp.Tests/RepositoryFixture.cs index 24ffbd93..077562ff 100644 --- a/LibGit2Sharp.Tests/RepositoryFixture.cs +++ b/LibGit2Sharp.Tests/RepositoryFixture.cs @@ -2,16 +2,15 @@ using System.IO; using System.Linq; using LibGit2Sharp.Tests.TestHelpers; -using NUnit.Framework; +using Xunit; namespace LibGit2Sharp.Tests { - [TestFixture] public class RepositoryFixture : BaseFixture { private const string commitSha = "8496071c1b46c854b31185ea97743be6a8774479"; - [Test] + [Fact] public void CanCreateBareRepo() { SelfCleaningDirectory scd = BuildSelfCleaningDirectory(); @@ -30,7 +29,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void CanCreateStandardRepo() { SelfCleaningDirectory scd = BuildSelfCleaningDirectory(); @@ -68,7 +67,7 @@ namespace LibGit2Sharp.Tests (attribs & FileAttributes.Hidden).ShouldEqual(FileAttributes.Hidden); } - [Test] + [Fact] public void CanReinitARepository() { SelfCleaningDirectory scd = BuildSelfCleaningDirectory(); @@ -80,7 +79,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void CreatingRepoWithBadParamsThrows() { Assert.Throws<ArgumentException>(() => Repository.Init(string.Empty)); @@ -115,7 +114,7 @@ namespace LibGit2Sharp.Tests repo.Tags.Count().ShouldEqual(0); } - [Test] + [Fact] public void CanOpenBareRepositoryThroughAFullPathToTheGitDir() { string path = Path.GetFullPath(BareTestRepoPath); @@ -126,7 +125,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void CanOpenStandardRepositoryThroughAWorkingDirPath() { using (var repo = new Repository(StandardTestRepoWorkingDirPath)) @@ -136,7 +135,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void OpeningStandardRepositoryThroughTheGitDirGuessesTheWorkingDirPath() { using (var repo = new Repository(StandardTestRepoPath)) @@ -146,7 +145,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void CanOpenRepository() { using (var repo = new Repository(BareTestRepoPath)) @@ -159,53 +158,53 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void OpeningNonExistentRepoThrows() { Assert.Throws<LibGit2Exception>(() => { new Repository("a_bad_path"); }); } - [Test] + [Fact] public void OpeningRepositoryWithBadParamsThrows() { Assert.Throws<ArgumentException>(() => new Repository(string.Empty)); Assert.Throws<ArgumentNullException>(() => new Repository(null)); } - [Test] + [Fact] public void CanLookupACommitByTheNameOfABranch() { using (var repo = new Repository(BareTestRepoPath)) { GitObject gitObject = repo.Lookup("refs/heads/master"); gitObject.ShouldNotBeNull(); - Assert.IsInstanceOf<Commit>(gitObject); + Assert.IsType<Commit>(gitObject); } } - [Test] + [Fact] public void CanLookupACommitByTheNameOfALightweightTag() { using (var repo = new Repository(BareTestRepoPath)) { GitObject gitObject = repo.Lookup("refs/tags/lw"); gitObject.ShouldNotBeNull(); - Assert.IsInstanceOf<Commit>(gitObject); + Assert.IsType<Commit>(gitObject); } } - [Test] + [Fact] public void CanLookupATagAnnotationByTheNameOfAnAnnotatedTag() { using (var repo = new Repository(BareTestRepoPath)) { GitObject gitObject = repo.Lookup("refs/tags/e90810b"); gitObject.ShouldNotBeNull(); - Assert.IsInstanceOf<TagAnnotation>(gitObject); + Assert.IsType<TagAnnotation>(gitObject); } } - [Test] + [Fact] public void CanLookupObjects() { using (var repo = new Repository(BareTestRepoPath)) @@ -216,7 +215,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void CanLookupSameObjectTwiceAndTheyAreEqual() { using (var repo = new Repository(BareTestRepoPath)) @@ -228,7 +227,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void LookupObjectByWrongShaReturnsNull() { using (var repo = new Repository(BareTestRepoPath)) @@ -238,7 +237,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void LookupObjectByWrongTypeReturnsNull() { using (var repo = new Repository(BareTestRepoPath)) @@ -249,7 +248,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void LookupObjectByUnknownReferenceNameReturnsNull() { using (var repo = new Repository(BareTestRepoPath)) @@ -259,7 +258,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void CanLookupWhithShortIdentifers() { const string expectedAbbrevSha = "edfecad"; @@ -287,7 +286,7 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void LookingUpWithBadParamsThrows() { using (var repo = new Repository(BareTestRepoPath)) @@ -301,42 +300,42 @@ namespace LibGit2Sharp.Tests } } - [Test] + [Fact] public void CanDiscoverABareRepoGivenTheRepoPath() { string path = Repository.Discover(BareTestRepoPath); path.ShouldEqual(Path.GetFullPath(BareTestRepoPath + Path.DirectorySeparatorChar)); } - [Test] + [Fact] public void CanDiscoverABareRepoGivenASubDirectoryOfTheRepoPath() { string path = Repository.Discover(Path.Combine(BareTestRepoPath, "objects/4a")); path.ShouldEqual(Path.GetFullPath(BareTestRepoPath + Path.DirectorySeparatorChar)); } - [Test] + [Fact] public void CanDiscoverAStandardRepoGivenTheRepoPath() { string path = Repository.Discover(StandardTestRepoPath); path.ShouldEqual(Path.GetFullPath(StandardTestRepoPath + Path.DirectorySeparatorChar)); } - [Test] + [Fact] public void CanDiscoverAStandardRepoGivenASubDirectoryOfTheRepoPath() { string path = Repository.Discover(Path.Combine(StandardTestRepoPath, "objects/4a")); path.ShouldEqual(Path.GetFullPath(StandardTestRepoPath + Path.DirectorySeparatorChar)); } - [Test] + [Fact] public void CanDiscoverAStandardRepoGivenTheWorkingDirPath() { string path = Repository.Discover(StandardTestRepoWorkingDirPath); path.ShouldEqual(Path.GetFullPath(StandardTestRepoPath + Path.DirectorySeparatorChar)); } - [Test] + [Fact] public void DiscoverReturnsNullWhenNoRepoCanBeFound() { string path = Path.GetTempFileName(); |