10000 Reorder Repository tests · MicrosoftWebMatrix/libgit2sharp@236231b · GitHub
[go: up one dir, main page]

Skip to content

Commit 236231b

Browse files
committed
Reorder Repository tests
1 parent c3c806c commit 236231b

File tree

1 file changed

+51
-49
lines changed

1 file changed

+51
-49
lines changed

LibGit2Sharp.Tests/RepositoryFixture.cs

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ public void CanCreateStandardRepo()
5151
}
5252
}
5353

54+
[Test]
55+
public void CreatingRepoWithBadParamsThrows()
56+
{
57+
Assert.Throws<ArgumentException>(() => Repository.Init(string.Empty));
58+
Assert.Throws<ArgumentNullException>(() => Repository.Init(null));
59+
}
60+
5461
private static void AssertInitializedRepository(Repository repo)
5562
{
5663
repo.Info.Path.ShouldNotBeNull();
@@ -76,11 +83,51 @@ private static void AssertInitializedRepository(Repository repo)
7683
repo.Tags.Count().ShouldEqual(0);
7784
}
7885

86+
7987
[Test]
80-
public void CreatingRepoWithBadParamsThrows()
88+
public void CanOpenRepoWithFullPath()
8189
{
82-
Assert.Throws<ArgumentException>(() => Repository.Init(string.Empty));
83-
Assert.Throws<ArgumentNullException>(() => Repository.Init(null));
90+
var path = Path.GetFullPath(Constants.BareTestRepoPath);
91+
using (var repo = new Repository(path))
92+
{
93+
repo.ShouldNotBeNull();
94+
}
95+
}
96+
97+
[Test]
98+
[Platform(Exclude = "Linux,Unix", Reason = "No need to test windows path separators on non-windows platforms")]
99+
// See http://www.nunit.org/index.php?p=platform&r=2.6 for other platforms that can be excluded/included.
100+
public void CanOpenRepoWithWindowsPathSeparators()
101+
{
102+
using (new Repository(@".\Resources\testrepo.git"))
103+
{
104+
}
105+
}
106+
107+
[Test]
108+
public void CanOpenRepository()
109+
{
110+
using (var repo = new Repository(Constants.BareTestRepoPath))
111+
{
112+
repo.Info.Path.ShouldNotBeNull();
113+
repo.Info.WorkingDirectory.ShouldBeNull();
114+
repo.Info.IsBare.ShouldBeTrue();
115+
repo.Info.IsEmpty.ShouldBeFalse();
116+
repo.Info.IsHeadDetached.ShouldBeFalse();
117+
}
118+
}
119+
120+
[Test]
121+
public void OpeningNonExistentRepoThrows()
122+
{
123+
Assert.Throws<ApplicationException>(() => { new Repository("a_bad_path"); });
124+
}
125+
126+
[Test]
127+
public void OpeningRepositoryWithBadParamsThrows()
128+
{
129+
Assert.Throws<ArgumentException>(() => new Repository(string.Empty));
130+
Assert.Throws<ArgumentNullException>(() => new Repository(null));
84131
}
85132

86133
[Test]
@@ -139,15 +186,6 @@ public void CanLookupSameObjectTwiceAndTheyAreEqual()
139186
}
140187
}
141188

142-
[Test]
143-
public void CanOpenRepoWithFullPath()
144-
{
145-
var path = Path.GetFullPath(Constants.BareTestRepoPath);
146-
using (new Repository(path))
147-
{
148-
}
149-
}
150-
151189
[Test]
152190
public void LookupObjectByWrongShaReturnsNull()
153191
{
@@ -194,43 +232,7 @@ public void LookingUpWithBadParamsThrows()
194232
}
195233

196234
[Test]
197-
[Platform(Exclude = "Linux,Unix", Reason = "No need to test windows path separators on non-windows platforms")]
198-
// See http://www.nunit.org/index.php?p=platform&r=2.6 for other platforms that can be excluded/included.
199-
public void CanOpenRepoWithWindowsPathSeparators()
200-
{
201-
using (new Repository(@".\Resources\testrepo.git"))
202-
{
203-
}
204-
}
205-
206-
[Test]
207-
public void CanOpenRepository()
208-
{
209-
using (var repo = new Repository(Constants.BareTestRepoPath))
210-
{
211-
repo.Info.Path.ShouldNotBeNull();
212-
repo.Info.WorkingDirectory.ShouldBeNull();
213-
repo.Info.IsBare.ShouldBeTrue();
214-
repo.Info.IsEmpty.ShouldBeFalse();
215-
repo.Info.IsHeadDetached.ShouldBeFalse();
216-
}
217-
}
218-
219-
[Test]
220-
public void OpenNonExistentRepoThrows()
221-
{
222-
Assert.Throws<ApplicationException>(() => { new Repository("a_bad_path"); });
223-
}
224-
225-
[Test]
226-
public void OpeningRepositoryWithBadParamsThrows()
227-
{
228-
Assert.Throws<ArgumentException>(() => new Repository(string.Empty));
229-
Assert.Throws<ArgumentNullException>(() => new Repository(null));
230-
}
231-
232-
[Test]
233-
public void CanTellIfObjectsExistInRepository()
235+
public void CanCheckForObjectExistence()
234236
{
235237
using (var repo = new Repository(Constants.BareTestRepoPath))
236238
{

0 commit comments

Comments
 (0)
0