public async Task PostEmptyMessageException() { // We create the conversation or the dispose will throw not found var rand = Guid.NewGuid().ToString(); string[] usernames = _conversationId.Split('_'); var addConversationRequestBody = new AddConversationRequestBody { Participants = new List <string> { usernames[0], usernames[1] }, FirstMessage = new Dictionary <string, string> { { "Id", rand }, { "Text", "ae" }, { "SenderUsername", usernames[0] } } }; await _chatServiceClient.AddConversation(addConversationRequestBody); _messagesToCleanup.Add(rand); var id = Guid.NewGuid().ToString(); var addMessageRequestBody = new AddMessageRequestBody { Id = id, SenderUsername = "******", Text = "", }; var exception = await Assert.ThrowsAsync <ChatServiceException>( () => _chatServiceClient.AddMessage(_conversationId, addMessageRequestBody)); Assert.Equal(HttpStatusCode.BadRequest, exception.StatusCode); }
public async Task PostGetMessage() { var conversation = CreateRandomPostConversationRequest(); var message = CreateRandomPostMessageRequest(); var fetchedConversation = await _chatServiceClient.AddConversation(conversation); var fetchedMessage = await _chatServiceClient.AddMessage(fetchedConversation.Id, message); Assert.Equal(message.Id, fetchedMessage.Id); }