private async Task PostToReconectedUser()
        {
            _hub.Context = _aliceContext;

            string aliceMessage = "Hello again, Bob!";
            await _hub.PostTo(privateRoomId, aliceMessage);

            Assert.AreEqual($"{Resources.Alice.FirstName} said '{aliceMessage}' in '{privateRoomId}'", _events.Dequeue());


            _hub.Context = _bobContext;
            //_hub.Ack(5);

            //Bob joins invitation
            _hub.JoinRoom(privateRoomId);

            //Alice got notification that Alice joined
            Assert.AreEqual($"{_bobUserId} joined '{privateRoomId}'", _events.Dequeue());
            //_hub.Ack(6);


            //Bob receved data from server
            Assert.AreEqual($"1 initial user(s) added to '{privateRoomId}'", _events.Dequeue());
            //_hub.Ack(7);

            Assert.AreEqual("Initial Messages Added", _events.Dequeue());
            //_hub.Ack(8);

            //Ack Alice message
            _hub.Context = _aliceContext;
            //_hub.Ack(18);

            //Should be empty
            Assert.AreEqual(0, _events.Count);
        }
        public async Task JoinAndChat()
        {
            // Substitute Mock object on Hub
            _hub.Clients = (IHubCallerConnectionContext <ITextChatHubClient>)TextChatHubCtrl.Instance.Clients;

            // Prepare users contexts
            PrepareContexts();

            // Alice:  Enter, Join 'English'
            _hub.Context = _aliceContext;
            await _hub.OnConnected();

            //_hub.Ack(2); // This ack should have no effect, b/c there is no 3 to acknowledge yet
            _hub.JoinRoom(Resources.Alice.Message.RoomId);
            //_hub.Ack(1); _hub.Ack(4); // Not need to ack 2, 3 , b/c the managed queue bundled 2-5 together after we acked 1.

            // Evaluate
            Assert.AreEqual($"0 initial user(s) added", _events.Dequeue());
            var aliceEvent = (dynamic)_events.Dequeue();

            _aliceUserId = aliceEvent.userId;
            Assert.AreEqual($"{Resources.Alice.FirstName} joined the chat", aliceEvent.message);
            Assert.AreEqual($"0 initial user(s) added to '{Resources.Alice.Message.RoomId}'", _events.Dequeue());
            Assert.AreEqual("Initial Messages Added", _events.Dequeue());
            Assert.AreEqual(0, _events.Count);

            // Bob: Enter, Join 'English', Chat
            _hub.Context = _bobContext;
            await _hub.OnConnected();

            _hub.JoinRoom(Resources.Bob.Message.RoomId);

            // Ack all messagess
            //_hub.Ack(1); _hub.Ack(4);
            //_hub.Context = _aliceContext; _hub.Ack(5); _hub.Ack(6);

            // Evaluate
            Assert.AreEqual($"1 initial user(s) added", _events.Dequeue());
            var evt = (dynamic)_events.Dequeue();

            Assert.AreEqual($"{Resources.Bob.FirstName} joined the chat", evt.message);             // One received by Bob
            evt = _events.Dequeue();
            Assert.AreEqual($"{Resources.Bob.FirstName} joined the chat", evt.message);             // One received by Alice
            Assert.AreEqual($"{evt.userId} joined '{Resources.English.RoomId}'", _events.Dequeue());
            Assert.AreEqual($"1 initial user(s) added to '{Resources.Alice.Message.RoomId}'", _events.Dequeue());
            Assert.AreEqual("Initial Messages Added", _events.Dequeue());
            Assert.AreEqual(0, _events.Count);

            // Alice: Chat in English Room
            _hub.Context = _aliceContext;
            await _hub.SetTypingActivityIn(Resources.Alice.Message.RoomId);

            await _hub.PostTo(Resources.Alice.Message.RoomId, Resources.Alice.Message.Text);

            await _hub.SetTypingActivityIn(Resources.Alice.Message.RoomId);

            _hub.JoinRoom(Resources.French.RoomId);
            await _hub.SetTypingActivityIn(Resources.French.RoomId);

            // Ack all messagess
            _hub.Context = _bobContext;             //_hub.Ack(5); _hub.Ack(9);
            _hub.Context = _aliceContext;           //_hub.Ack(7); _hub.Ack(13);

            // Evaluate
            Assert.AreEqual($"{_aliceUserId} is typing in '{Resources.Alice.Message.RoomId}'", _events.Dequeue());
            Assert.AreEqual($"{_aliceUserId} is typing in '{Resources.Alice.Message.RoomId}'", _events.Dequeue());
            Assert.AreEqual($"{_aliceUserId} is done typing", _events.Dequeue());
            Assert.AreEqual($"{_aliceUserId} is done typing", _events.Dequeue());
            Assert.AreEqual($"{Resources.Alice.Message.FirstName} said '{Resources.Alice.Message.Text}' in '{Resources.Alice.Message.RoomId}'", _events.Dequeue());
            Assert.AreEqual($"{_aliceUserId} is typing in '{Resources.Alice.Message.RoomId}'", _events.Dequeue());
            Assert.AreEqual($"{_aliceUserId} is typing in '{Resources.Alice.Message.RoomId}'", _events.Dequeue());
            Assert.AreEqual($"0 initial user(s) added to '{Resources.French.RoomId}'", _events.Dequeue());
            Assert.AreEqual("Initial Messages Added", _events.Dequeue());
            Assert.AreEqual($"{_aliceUserId} is done typing", _events.Dequeue());
            Assert.AreEqual($"{_aliceUserId} is done typing", _events.Dequeue());
            Assert.AreEqual($"{_aliceUserId} is typing in '{Resources.French.RoomId}'", _events.Dequeue());
            Assert.AreEqual(0, _events.Count);

            // Bob: Chat in English Room
            _hub.Context = _bobContext;
            await _hub.PostTo(Resources.Bob.Message.RoomId, Resources.Bob.Message.Text);

            // Ack all messagess
            _hub.Context = _aliceContext;             //_hub.Ack(14);

            // Evaluate
            Assert.AreEqual($"{Resources.Bob.Message.FirstName} said '{Resources.Bob.Message.Text}' in '{Resources.Bob.Message.RoomId}'", _events.Dequeue());
            Assert.AreEqual(0, _events.Count);
        }