public async Task EnsuresNonNullArguments() { var client = new GistCommentsClient(Substitute.For<IApiConnection>()); await AssertEx.Throws<ArgumentNullException>(async () => await client.Create("24", null)); await AssertEx.Throws<ArgumentException>(async () => await client.Create("24", "")); }
public async Task PostsToCorrectUrl() { var comment = "This is a comment."; var connection = Substitute.For<IApiConnection>(); var client = new GistCommentsClient(connection); await client.Create("24", comment); connection.Received().Post<GistComment>(Arg.Is<Uri>(u => u.ToString() == "gists/24/comments"), Arg.Is<BodyWrapper>(x => x.Body == comment)); }