Exemple #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;
 }
Exemple #2
0
        private IList <MailboxProcessor> GetMailboxProcessors(IRequestQueueManager queueManager)
        {
            IGetMoveInfo             getMoveInfo             = new GetMoveInfo(base.Logger, this.CmdletPool);
            IEventNotificationSender eventNotificationSender = new EventNotificationSender();

            IMailboxPolicy[] mailboxPolicies = this.GetMailboxPolicies(eventNotificationSender);
            return(new MailboxProcessor[]
            {
                new MailboxStatisticsLogger(base.Logger, this.LogCollector),
                new MailboxPolicyProcessor(base.Logger, getMoveInfo, this.MoveInjector, mailboxPolicies)
            });
        }
Exemple #3
0
        public TestContext()
        {
            var queue = new InMemoryQueues();
            var store = new InMemoryStore(Users.Values);

            var eventNotificationSender = new EventNotificationSender();
            var notificationHandlers    = new List <Type>()
            {
                typeof(ChatNotifier),
                typeof(ChatMessageNotifier),
                typeof(ChatParticipantNotifier)
            };
            var notificationBus = new InMemoryBus(queue, r => r.NotificationQueue, type => _chatNotificationModuleProvider.GetService(type), notificationHandlers);
            var chatNotificationModuleServiceCollection = new ServiceCollection();

            chatNotificationModuleServiceCollection.RegisterDotChat(new TestChatNotificationModule(notificationBus, store, eventNotificationSender));
            _chatNotificationModuleProvider = chatNotificationModuleServiceCollection.BuildServiceProvider();

            var workerHandlers = new List <Type>()
            {
                typeof(ChatsWorker),
                typeof(ChatMessagesWorker),
                typeof(ChatMessageIndexationWorker),
                typeof(ChatParticipantsWorker),
                typeof(ChatSystemMessagesWorker)
            };
            var workerBus = new InMemoryBus(queue, r => r.WorkerQueue, type => _chatWorkerModuleProvider.GetService(type), workerHandlers);
            var chatWorkerModuleServiceCollection = new ServiceCollection();

            chatWorkerModuleServiceCollection.RegisterDotChat(new TestChatWorkerModule(workerBus, store));
            _chatWorkerModuleProvider = chatWorkerModuleServiceCollection.BuildServiceProvider();

            foreach (var user in Users)
            {
                _userContexts.Add(user.Key, new TestUserContext(user.Value.UserId, _chatNotificationModuleProvider.GetService <IDotChat>(), eventNotificationSender, _chatIds));
            }

            NotificationBusTask = notificationBus.Start();
            WorkerBusTask       = workerBus.Start();
        }
 public TestChatNotificationModule(InMemoryBus bus, InMemoryStore store, EventNotificationSender eventNotificationSender) : base(new TestChatServiceModule(bus, store), new ChatNotificationsConfiguration())
 {
     _eventNotificationSender = eventNotificationSender;
 }