Implement Lock/Unlock Issue

This commit is contained in:
Prayank Mathur
2016-03-25 11:26:37 +05:30
parent f354d1bf00
commit 171b3c520a
9 changed files with 265 additions and 8 deletions

View File

@@ -329,11 +329,61 @@ public class ObservableIssuesClientTests
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableIssuesClient(gitHubClient);
Assert.Throws<ArgumentNullException>(() => client.Create(null, "name", new NewIssue("title")));
Assert.Throws<ArgumentException>(() => client.Create("", "name", new NewIssue("x")));
Assert.Throws<ArgumentNullException>(() => client.Create("owner", null, new NewIssue("x")));
Assert.Throws<ArgumentException>(() => client.Create("owner", "", new NewIssue("x")));
Assert.Throws<ArgumentNullException>(() => client.Create("owner", "name", null));
Assert.Throws<ArgumentNullException>(() => client.Update(null, "name", 42, new IssueUpdate()));
Assert.Throws<ArgumentException>(() => client.Update("", "name", 42, new IssueUpdate()));
Assert.Throws<ArgumentNullException>(() => client.Update("owner", null, 42, new IssueUpdate()));
Assert.Throws<ArgumentException>(() => client.Update("owner", "", 42, new IssueUpdate()));
Assert.Throws<ArgumentNullException>(() => client.Update("owner", "name", 42, null));
}
}
public class TheLockIssueMethod
{
[Fact]
public void LockIssue()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableIssuesClient(gitHubClient);
client.LockIssue("fake", "repo", 42);
gitHubClient.Issue.Received().LockIssue("fake", "repo", 42);
}
[Fact]
public void EnsuresArgumentsNotNull()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableIssuesClient(gitHubClient);
Assert.Throws<ArgumentNullException>(() => client.LockIssue(null, "name", 42));
Assert.Throws<ArgumentException>(() => client.LockIssue("", "name", 42));
Assert.Throws<ArgumentNullException>(() => client.LockIssue("owner", null, 42));
Assert.Throws<ArgumentException>(() => client.LockIssue("owner", "", 42));
}
}
public class TheUnlockIssueMethod
{
[Fact]
public void UnlockIssue()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableIssuesClient(gitHubClient);
client.UnlockIssue("fake", "repo", 42);
gitHubClient.Issue.Received().UnlockIssue("fake", "repo", 42);
}
[Fact]
public void EnsuresArgumentsNotNull()
{
var gitHubClient = Substitute.For<IGitHubClient>();
var client = new ObservableIssuesClient(gitHubClient);
Assert.Throws<ArgumentNullException>(() => client.UnlockIssue(null, "name", 42));
Assert.Throws<ArgumentException>(() => client.UnlockIssue("", "name", 42));
Assert.Throws<ArgumentNullException>(() => client.UnlockIssue("owner", null, 42));
Assert.Throws<ArgumentException>(() => client.UnlockIssue("owner", "", 42));
}
}