Ejemplo n.º 1
0
 /// <summary>
 /// Gets the latest message in a group chat with the specified name.
 /// </summary>
 /// <param name="groupName">Group chat name.</param>
 /// <returns>DTO containing the latest message data.</returns>
 /// <remarks>Catches <see cref="HttpRequestException"/> and <see cref="System.Text.Json.JsonException"/> instances, throws <see cref="RocketChatApiException"/> instead.</remarks>
 private async Task <MessageDto> GetLastMessageInGroupAsync(string groupName)
 {
     try
     {
         return(await _restApiClient.GetLastMessageInGroupAsync(groupName).ConfigureAwait(false));
     }
     catch (HttpRequestException ex)
     {
         throw new RocketChatApiException(ex);
     }
     catch (JsonException ex)
     {
         throw new RocketChatApiException(ex);
     }
 }
Ejemplo n.º 2
0
        public async Task GetLastMessageInGroupAsync_ShouldReturnLatestMessage()
        {
            var message = await _client.GetLastMessageInGroupAsync(_groupChatName).ConfigureAwait(false);

            Assert.NotNull(message);
        }