public void CanDeleteChatHubConnectionsTest()
        {
            IEmployerDAO <Employer> EmployerDAO = new EmployerDAO(_connection);
            Employer testEmployer = new Employer();

            testEmployer.FirstName   = "Marcelo";
            testEmployer.LastName    = "Carvalho";
            testEmployer.UserName    = "******";
            testEmployer.Password    = "******";
            testEmployer.Email       = "*****@*****.**";
            testEmployer.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testEmployer.Address     = "Lixa";

            Employer returned = EmployerDAO.Create(testEmployer);

            IMateDAO <Mate> MateDAO  = new MateDAO(_connection);
            Mate            testMate = new Mate();

            testMate.FirstName   = "Miguel";
            testMate.LastName    = "Dev";
            testMate.UserName    = "******";
            testMate.Password    = "******";
            testMate.Email       = "*****@*****.**";
            testMate.Description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";
            testMate.Address     = "Figueiró";
            testMate.Categories  = new[] { Categories.CLEANING, Categories.PLUMBING };
            testMate.Rank        = Ranks.SUPER_MATE;
            testMate.Range       = 20;

            Mate returnedMate = MateDAO.Create(testMate);

            ChatDAO chatDao = new ChatDAO(_connection);

            chatDao.AddChatHubConnection(returned.Id, "connection1");
            chatDao.AddChatHubConnection(returnedMate.Id, "connection2");

            chatDao.DeleteChatHubConnection("connection1");
            chatDao.DeleteChatHubConnection("connection2");

            ChatConnection connection1 = chatDao.GetChatConnectionFromUserId(returned.Id);
            ChatConnection connection2 = chatDao.GetChatConnectionFromUserId(returnedMate.Id);

            Assert.Null(connection1);
            Assert.Null(connection2);

            _fixture.Dispose();
        }
        /// <summary>
        /// Override de OnDisconnectedAsync
        /// Este metodo e chamado quando deixa de esistir uma conexão ao hub e
        /// remove a conexão da BD
        /// </summary>
        /// <returns>Retorna uma task assincrona UserDisconnected com o id de conexão</returns>
        public override async Task OnDisconnectedAsync(Exception ex)
        {
            try
            {
                await Clients.All.SendAsync("UserDisconnected", Context.ConnectionId);

                int     userId  = (int)ClaimHelper.GetIdFromClaimIdentity((ClaimsIdentity)Context.User.Identity);
                ChatDAO chatDao = new ChatDAO(_connection);
                chatDao.DeleteChatHubConnection(Context.ConnectionId);

                await base.OnDisconnectedAsync(ex);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }