public CreateConversationAsync ( string recipient, string body ) : Task |
||
recipient | string | The recipient username, this person will receive the message. |
body | string | The message itself, similar to the body of an email. |
return | Task |
public async Task CreateConversationAsync_True() { var mockUrl = "https://api.imgur.com/3/conversations/Bob"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockConversationEndpointResponses.CreateConversation) }; var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new ConversationEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var created = await endpoint.CreateConversationAsync("Bob", "Hello World!").ConfigureAwait(false); Assert.True(created); }
public async Task CreateConversationAsync_WithOAuth2TokenNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new ConversationEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.CreateConversationAsync("Recipient", "Body").ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }