public async Task EnsuresArgumentsNotNull() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoryCommentsClient(connection); await AssertEx.Throws<ArgumentNullException>(async () => await client.Update(null, "name", 42, "updated comment")); await AssertEx.Throws<ArgumentException>(async () => await client.Update("", "name", 42, "updated comment")); await AssertEx.Throws<ArgumentNullException>(async () => await client.Update("owner", null, 42, "updated comment")); await AssertEx.Throws<ArgumentException>(async () => await client.Update("owner", "", 42, "updated comment")); await AssertEx.Throws<ArgumentNullException>(async () => await client.Update("owner", "name", 42, null)); }
public void PostsToCorrectUrl() { const string issueCommentUpdate = "updated comment"; var connection = Substitute.For <IApiConnection>(); var client = new RepositoryCommentsClient(connection); client.Update("fake", "repo", 42, issueCommentUpdate); connection.Received().Patch <CommitComment>(Arg.Is <Uri>(u => u.ToString() == "repos/fake/repo/comments/42"), Arg.Any <object>()); }
public async Task PostsToCorrectUrlWithRepositoryId() { const string issueCommentUpdate = "updated comment"; var connection = Substitute.For <IApiConnection>(); var client = new RepositoryCommentsClient(connection); await client.Update(1, 42, issueCommentUpdate); connection.Received().Patch <CommitComment>(Arg.Is <Uri>(u => u.ToString() == "repositories/1/comments/42"), Arg.Any <object>()); }