提交 5d64757f 编写于 作者: N nulltoken

Collapsed some assertions into higher level tests in order to make things...

Collapsed some assertions into higher level tests in order to make things easier to read and maintain

Credit goes to @tclem for raising this
上级 0739544b
......@@ -61,14 +61,9 @@ private static void AssertInitializedRepository(Repository repo)
}
[Test]
public void CreateRepoWithEmptyStringThrows()
public void CreatingRepoWithBadParamsThrows()
{
Assert.Throws<ArgumentException>(() => Repository.Init(string.Empty));
}
[Test]
public void CreateRepoWithNullThrows()
{
Assert.Throws<ArgumentNullException>(() => Repository.Init(null));
}
......@@ -169,20 +164,12 @@ public void LookupObjectByUnknownReferenceNameReturnsNull()
}
[Test]
public void LookupWithEmptyStringThrows()
public void LookingUpWithBadParamsThrows()
{
using (var repo = new Repository(Constants.TestRepoPath))
{
Assert.Throws<ArgumentException>(() => repo.Lookup(string.Empty));
Assert.Throws<ArgumentException>(() => repo.Lookup<GitObject>(string.Empty));
}
}
[Test]
public void LookupWithNullThrows()
{
using (var repo = new Repository(Constants.TestRepoPath))
{
Assert.Throws<ArgumentNullException>(() => repo.Lookup((string)null));
Assert.Throws<ArgumentNullException>(() => repo.Lookup((ObjectId)null));
Assert.Throws<ArgumentNullException>(() => repo.Lookup<Commit>((string)null));
......@@ -220,14 +207,9 @@ public void OpenNonExistentRepoThrows()
}
[Test]
public void OpeningRepositoryWithEmptyPathThrows()
public void OpeningRepositoryWithBadParamsThrows()
{
Assert.Throws<ArgumentException>(() => new Repository(string.Empty));
}
[Test]
public void OpeningRepositoryWithNullPathThrows()
{
Assert.Throws<ArgumentNullException>(() => new Repository(null));
}
......@@ -244,19 +226,11 @@ public void CanTellIfObjectsExistInRepository()
}
[Test]
public void CallingExistsWithEmptyThrows()
public void CheckingForObjectExistenceWithBadParamsThrows()
{
using (var repo = new Repository(Constants.TestRepoPath))
{
Assert.Throws<ArgumentException>(() => repo.HasObject(string.Empty));
}
}
[Test]
public void CallingExistsWithNullThrows()
{
using (var repo = new Repository(Constants.TestRepoPath))
{
Assert.Throws<ArgumentNullException>(() => repo.HasObject(null));
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册