Ejemplo n.º 1
0
        /// <summary>
        /// Gets the latest group chat message timestamp.
        /// </summary>
        /// <returns>The latest group chat message timestamp.</returns>
        private async Task <DateTime> GetLastMessageTimeStampAsync()
        {
            try
            {
                var lastMessageTime = await _rocketChatClient.GetLastMessageTimeStampAsync().ConfigureAwait(false);

                _chatClientErrorsCount = 0;

                return(lastMessageTime);
            }
            catch (RocketChatApiException ex)
            {
                _chatClientErrorsCount++;
                _logger.LogError(ex, $"Error occurred while obtaining time of the latest message in Rocket.Chat group ({_chatClientErrorsCount} / {MaxErrorsCount})");

                return(default);
 public void GetLastMessageTimeStampAsync_NoGroupName_ShouldThrowException()
 {
     _settingsProviderMock.Setup(x => x.GetGroupName()).Returns(string.Empty);
     Assert.ThrowsAsync <InvalidOperationException>(() => _rocketChatClient.GetLastMessageTimeStampAsync());
 }