Exemplo n.º 1
0
 public TestUserContext(Guid userId, IDotChat dotChat, EventNotificationSender eventNotificationSender, ConcurrentDictionary <string, Guid> chatIds)
 {
     if (Debugger.IsAttached)
     {
         _tries = int.MaxValue;
     }
     _userId  = userId;
     _dotChat = dotChat;
     _eventNotificationSender = eventNotificationSender;
     _chatIds = chatIds;
 }
Exemplo n.º 2
0
        private void AddTestData(IDotChat dotChat)
        {
            dotChat.Chats.Add(Users[0].UserId, null, new ChatInfo
            {
                Name = "TestChat"
            }, new Basic.Participants.ParticipationCandidates(new List <ParticipationCandidate> {
                new ParticipationCandidate(Users[0].UserId, Participants.ChatParticipantType.Admin),
                new ParticipationCandidate(Users[3].UserId, Participants.ChatParticipantType.Admin)
            }, new List <ParticipationCandidate> {
            })).ContinueWith(async r =>
            {
                await Task.Delay(TimeSpan.FromSeconds(10));
                await dotChat.ChatParticipants.Append(Users[0].UserId, r.Result, new List <ParticipationCandidate> {
                    new ParticipationCandidate(Users[1].UserId, Participants.ChatParticipantType.Participant),
                    new ParticipationCandidate(Users[2].UserId, Participants.ChatParticipantType.Participant)
                }, new List <ParticipationCandidate>());
            });

            Task.Delay(TimeSpan.FromSeconds(10))
            .ContinueWith((t) =>
                          dotChat.Chats.Add(Users[0].UserId, null, new ChatInfo
            {
                Name = "TestChat2"
            }, new Basic.Participants.ParticipationCandidates(new List <ParticipationCandidate> {
                new ParticipationCandidate(Users[0].UserId, Participants.ChatParticipantType.Admin),
                new ParticipationCandidate(Users[1].UserId, Participants.ChatParticipantType.Admin)
            }, new List <ParticipationCandidate> {
            })));

            foreach (var item in Enumerable.Range(3, 10))
            {
                dotChat.Chats.Add(Users[0].UserId, null, new ChatInfo
                {
                    Name = $"TestChat{item}"
                }, new Basic.Participants.ParticipationCandidates(new List <ParticipationCandidate> {
                    new ParticipationCandidate(Users[0].UserId, Participants.ChatParticipantType.Admin),
                    new ParticipationCandidate(Users[3].UserId, Participants.ChatParticipantType.Admin)
                }, new List <ParticipationCandidate> {
                }));
            }
        }