public void TestRemoveUserToGroupChatReturnBadRequest() { mockChatService.Setup(x => x.RemoveUserFromGroupChat(It.IsAny <string>(), It.IsAny <string>())).Returns(false); var chatController = new ChatService.Controllers.ChatController(mockChatService.Object); IActionResult removeUserFromGroupChat = chatController.RemoveUserToGroupChat("af5af5asf5af5a5f", "asf6af7g7g7fg8f8gfgsd"); var type = removeUserFromGroupChat.GetType(); Assert.AreEqual(type.Name, "BadRequestResult"); }
public void TestAddUserToGroupChat() { mockChatService.Setup(x => x.AddUserToGroupChat(It.IsAny <string>(), It.IsAny <string>())).Returns(user); var chatController = new ChatService.Controllers.ChatController(mockChatService.Object); IActionResult addUserToGroupChat = chatController.AddUserToGroupChat("af5af5asf5af5a5f", "asf6af7g7g7fg8f8gfgsd"); var type = addUserToGroupChat.GetType(); Assert.AreEqual(type.Name, "OkObjectResult"); }
public void TestGetMembersReturnBadRequest() { IEnumerable <User> ienumableUser = null; mockChatService.Setup(x => x.GetAllMember(It.IsAny <string>())).Returns(ienumableUser); var chatController = new ChatService.Controllers.ChatController(mockChatService.Object); IActionResult getMembers = chatController.GetMembers("af5af5asf6af7g7g7fg8f8gfgsd"); var type = getMembers.GetType(); Assert.AreEqual(type.Name, "BadRequestResult"); }
public void TestGetAllConversationsReturnBadRequest() { IEnumerable <Conversation> iEnumerableConversation = null; mockChatService.Setup(x => x.GetByUserId(It.IsAny <string>())).Returns(iEnumerableConversation); var chatController = new ChatService.Controllers.ChatController(mockChatService.Object); IActionResult getAllConversations = chatController.GetAllConversations("aasfafas7afaf6a6fs"); var type = getAllConversations.GetType(); Assert.AreEqual(type.Name, "BadRequestResult"); }
public void TestGetMessageByConversation() { IEnumerable <MessageDetail> _iEnumableMessageDetail = listMessageDetails; mockChatService.Setup(x => x.GetByConversationId(It.IsAny <string>())).Returns(_iEnumableMessageDetail); var chatController = new ChatService.Controllers.ChatController(mockChatService.Object); IActionResult getMessageByConversation = chatController.GetMessageByConversation("aasfafas7afaf6a6fs"); var type = getMessageByConversation.GetType(); Assert.AreEqual(type.Name, "OkObjectResult"); }
public void TestAddToSeenIdsReturnBadRequest() { mockChatService.Setup(x => x.AddToSeenIds(It.IsAny <string>(), It.IsAny <string>())).Returns(false); var chatController = new ChatService.Controllers.ChatController(mockChatService.Object); var contextMock = new Mock <HttpContext>(); contextMock.Setup(x => x.User).Returns(new ClaimsPrincipal(claims)); chatController.ControllerContext.HttpContext = contextMock.Object; IActionResult addToSeenIds = chatController.AddToSeenIds("adasfa8fa7fasf6a"); var type = addToSeenIds.GetType(); Assert.AreEqual(type.Name, "BadRequestResult"); }
public void TestCreateGroupChat() { mockChatService.Setup(x => x.CreateGroupChat(It.IsAny <Conversation>())).Returns(conversation); var chatController = new ChatService.Controllers.ChatController(mockChatService.Object); var contextMock = new Mock <HttpContext>(); contextMock.Setup(x => x.User).Returns(new ClaimsPrincipal(claims)); chatController.ControllerContext.HttpContext = contextMock.Object; IActionResult createGroupChat = chatController.CreateGroupChat(conversation); var type = createGroupChat.GetType(); Assert.AreEqual(type.Name, "OkObjectResult"); }
public void TestSendMessage() { mockChatService.Setup(x => x.AddMessage(It.IsAny <string>(), It.IsAny <MessageDetail>())).Returns(messageDetail); var chatController = new ChatService.Controllers.ChatController(mockChatService.Object); var contextMock = new Mock <HttpContext>(); contextMock.Setup(x => x.User).Returns(new ClaimsPrincipal(claims)); chatController.ControllerContext.HttpContext = contextMock.Object; IActionResult sendMessage = chatController.SendMessage("asf6asf6asf5asf5asf5", messageDetail); var type = sendMessage.GetType(); Assert.AreEqual(type.Name, "OkObjectResult"); }