public GetConversationAsync ( string conversationId, int page = null, int offset = null ) : Task |
||
conversationId | string | The conversation id. |
page | int | /// Page of message thread. Starting at 1 for the most recent 25 messages and counting upwards. Default: /// null /// |
offset | int | Additional offset in current page. |
Résultat | Task |
public async Task GetConversationAsync_WithOAuth2TokenNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new ConversationEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.GetConversationAsync("1234").ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }
public async Task GetConversationAsync_True() { var mockUrl = "https://api.imgur.com/3/conversations/1234/1/0"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockConversationEndpointResponses.GetConversation) }; var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new ConversationEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var conversation = await endpoint.GetConversationAsync("1234").ConfigureAwait(false); Assert.NotNull(conversation); Assert.Equal(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(1451010592), conversation.DateTime); Assert.Equal(false, conversation.Done); Assert.Equal(34361981, conversation.Id); Assert.Equal("Test 2", conversation.LastMessagePreview); Assert.Equal(3, conversation.Messages.Count()); Assert.Equal(3, conversation.MessageCount); Assert.Equal(2, conversation.Page); Assert.Equal("Bob", conversation.WithAccount); Assert.Equal(1198054, conversation.WithAccountId); Assert.True(conversation.Messages.Any()); }