Check null for newReaction

This commit is contained in:
lrz-hal
2016-05-30 16:19:54 +02:00
parent 6fef1ce1ed
commit c536b85ebf
2 changed files with 4 additions and 14 deletions
@@ -32,6 +32,7 @@ public class ReactionsClientTests
await Assert.ThrowsAsync<ArgumentException>(() => client.CommitComments.CreateReaction("", "name", 1, new NewReaction(ReactionType.Heart)));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.CommitComments.CreateReaction("owner", null, 1, new NewReaction(ReactionType.Heart)));
await Assert.ThrowsAsync<ArgumentException>(() => client.CommitComments.CreateReaction("owner", "", 1, new NewReaction(ReactionType.Heart)));
await Assert.ThrowsAsync<ArgumentException>(() => client.CommitComments.CreateReaction("owner", "name", 1, null));
}
}
@@ -31,12 +31,13 @@ namespace Octokit.Tests.Reactive
Assert.Throws<ArgumentException>(() => client.CommitComments.CreateReaction("", "name", 1, new NewReaction(ReactionType.Heart)));
Assert.Throws<ArgumentNullException>(() => client.CommitComments.CreateReaction("owner", null, 1, new NewReaction(ReactionType.Heart)));
Assert.Throws<ArgumentException>(() => client.CommitComments.CreateReaction("owner", "", 1, new NewReaction(ReactionType.Heart)));
Assert.Throws<ArgumentException>(() => client.CommitComments.CreateReaction("owner", "name", 1, null));
}
}
public class TheCreateMethod
{
[Fact]
[Fact]
public void RequestsCorrectUrl()
{
var githubClient = Substitute.For<IGitHubClient>();
@@ -45,18 +46,6 @@ namespace Octokit.Tests.Reactive
client.CommitComments.CreateReaction("fake", "repo", 1, newReaction);
githubClient.Received().Reaction.CommitComments.CreateReaction("fake", "repo", 1, newReaction);
}
[Fact]
public void EnsuresArgumentsNotNull()
{
var githubClient = Substitute.For<IGitHubClient>();
var client = new ObservableReactionsClient(githubClient);
Assert.Throws<ArgumentNullException>(() => client.CommitComments.CreateReaction(null, "name", 1, new NewReaction(ReactionType.Heart)));
Assert.Throws<ArgumentException>(() => client.CommitComments.CreateReaction("", "name", 1, new NewReaction(ReactionType.Heart)));
Assert.Throws<ArgumentNullException>(() => client.CommitComments.CreateReaction("owner", null, 1, new NewReaction(ReactionType.Heart)));
Assert.Throws<ArgumentException>(() => client.CommitComments.CreateReaction("owner", "", 1, new NewReaction(ReactionType.Heart)));
}
}
}