public async Task <ActionResult <User> > Refresh(RefreshTokenQuery query)
        {
            var principal = _tokenHandler.GetPrincipalFromExpiredToken(query.Token);

            query.Email = principal.Claims.FirstOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value;
            return(await _mediator.Send(query));
        }
        public void GivenRefreshTokenPostMethod_WhenReceivesCorrectQuery_ThenMediatorSendMethodShouldFire()
        {
            var mockClaimsPrincipal = Substitute.For <ClaimsPrincipal>();
            var refreshTokenQuery   = new RefreshTokenQuery
            {
                RefreshToken = "10101010",
                Token        = "2020202"
            };

            _mockTokenHandler.GetPrincipalFromExpiredToken(refreshTokenQuery.Token).ReturnsForAnyArgs(mockClaimsPrincipal);

            var authenticationController = new AuthenticationController(_mockMediator, _mockTokenHandler);

            authenticationController.Refresh(refreshTokenQuery);

            _mockMediator.Received().Send(refreshTokenQuery);
        }