public void CreateMessage() { User first = CreateMockingUser(); User second = CreateMockingUser(); Chatroom room = chats.CreateChat(first.UserToken, second.UserPublicToken, ref message); chats.CreateMessage("Testing text.", first.UserToken, room.ChatToken, ref message); }
public void Complaint() { User first = CreateMockingUser(); User second = CreateMockingUser(); Chats chats = new Chats(context, new Users(context, new Validator()), new Validator()); Chatroom room = chats.CreateChat(first.UserToken, second.UserPublicToken, ref message); Message firstMessage = chats.CreateMessage("Test message.", first.UserToken, room.ChatToken, ref message); Message secondMessage = chats.CreateMessage("Test message.", second.UserToken, room.ChatToken, ref message); bool success = blocks.Complaint(first.UserToken, secondMessage.MessageId, "Test complaint.", ref message); bool tryCreateAgain = blocks.Complaint(first.UserToken, secondMessage.MessageId, "Test complaint.", ref message); bool tryUnknowMessage = blocks.Complaint(first.UserToken, 0, "Test complaint.", ref message); bool tryComplainOnHimSelf = blocks.Complaint(first.UserToken, firstMessage.MessageId, "Test complaint.", ref message); Assert.AreEqual(success, true); Assert.AreEqual(tryCreateAgain, false); Assert.AreEqual(tryUnknowMessage, false); Assert.AreEqual(tryComplainOnHimSelf, false); }
public void CreateComplaint() { User first = CreateMockingUser(); User second = CreateMockingUser(); Chats chats = new Chats(context, new Users(context, new Validator()), new Validator()); Chatroom room = chats.CreateChat(first.UserToken, second.UserPublicToken, ref message); Message roomMessage = chats.CreateMessage("Test message.", first.UserToken, room.ChatToken, ref message); BlockedUser block = blocks.CreateBlockedUser(first.UserId, second.UserId, "Test blocking."); Complaint complaint = blocks.CreateComplaint(first.UserId, block.BlockedId, roomMessage.MessageId, "Test complaint."); Assert.AreEqual(complaint.UserId, first.UserId); Assert.AreEqual(complaint.MessageId, roomMessage.MessageId); Assert.AreEqual(complaint.BlockId, block.BlockedId); }
public ActionResult <dynamic> SendMessage(ChatCache cache) { string answer = null; Message message = chats.CreateMessage( cache.message_text, cache.user_token, cache.chat_token, ref answer); if (message != null) { return(new { success = true, data = chats.ResponseMessage(message) }); } return(Return500Error(answer)); }