Ejemplo n.º 1
0
 private void GivenServicesReturnExpectedValues(CreateMessageRequest parsedInput, WebexTeamsMessage apiResponse,
                                                GlobalXMessage parsedApiResponse, Person sender)
 {
     _messageParser.ParseCreateMessageRequest(_input).Returns(parsedInput);
     _apiService.SendMessageAsync(parsedInput).Returns(Task.FromResult(apiResponse));
     _messageParser.ParseMessage(apiResponse).Returns(parsedApiResponse);
     _apiService.GetPersonAsync(apiResponse.PersonId).Returns(Task.FromResult(sender));
 }
        public async Task <Message> SendMessageAsync(Message message)
        {
            var request = _messageParser.ParseCreateMessageRequest(message);

            Models.Message result;
            try
            {
                result = await _apiService.SendMessageAsync(request).ConfigureAwait(false);
            }
            catch (InvalidParentException)
            {
                result = await ResendMessageWithRootParentId(message);
            }

            return(await GetSentMessageWithSender(result));
        }