コード例 #1
0
        private static bool IsConversationValid(ConversationRequest conversationRequest, ParticipationRepository participationRepository)
        {
            if (conversationRequest.UserIds.Count != conversationRequest.UserIds.Distinct().Count())
            {
                Log.Warn("Cannot make a conversation between two users of same id.");
                return(false);
            }

            return(!participationRepository.DoesConversationWithUsersExist(conversationRequest.UserIds));
        }
コード例 #2
0
        public void DoesConversationWithUsersExistTest()
        {
            var participationRepository = new ParticipationRepository();
            var participation           = new Participation(1, 1, 1);

            participationRepository.AddEntity(participation);

            Assert.True(participationRepository.DoesConversationWithUsersExist(new List <int> {
                participation.UserId
            }));
        }
コード例 #3
0
        private void NewConversation(List <int> userIds)
        {
            IsMultiUserConversation = false;

            if (!participationRepository.DoesConversationWithUsersExist(userIds))
            {
                clientService.CreateConversation(userIds);
            }
            else
            {
                int conversationId = participationRepository.GetConversationIdByUserIds(userIds);
                ConversationWindowManager.CreateConversationWindow(ServiceRegistry, conversationRepository.FindEntityById(conversationId));
            }
        }