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>()); }
public async Task EnsuresNonNullArguments() { var connection = Substitute.For<IApiConnection>(); var client = new RepositoryCommentsClient(connection); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update(null, "name", 42, "updated comment")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update("owner", null, 42, "updated comment")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update("owner", "name", 42, null)); await Assert.ThrowsAsync<ArgumentNullException>(() => client.Update(1, 42, null)); await Assert.ThrowsAsync<ArgumentException>(() => client.Update("", "name", 42, "updated comment")); await Assert.ThrowsAsync<ArgumentException>(() => client.Update("owner", "", 42, "updated comment")); }
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>()); }