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 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 ActionResult <dynamic> CreateChat(UserCache cache) { string message = null; Chatroom room = chats.CreateChat(cache.user_token, cache.opposide_public_token, ref message); if (room != null) { return(new { success = true, data = new { chat_id = room.ChatId, chat_token = room.ChatToken, created_at = room.CreatedAt } }); } return(Return500Error(message)); }
public void CreateChat() { User first = CreateMockingUser(); User second = CreateMockingUser(); Chatroom room = chats.CreateChat(first.UserToken, second.UserPublicToken, ref message); }