Exemplo n.º 1
0
        /// <summary>
        /// Permet de récupérer un RefreshToken via sa valeur
        /// </summary>
        /// <param name="token"></param>
        /// <returns>RefreshToken</returns>
        public async Task <RefreshToken> GetRefreshTokenByValue(string token)
        {
            RefreshToken refreshToken = null;

            if (!String.IsNullOrWhiteSpace(token))
            {
                refreshToken = await _repo.GetRefreshTokenByValue(token);
            }

            return(refreshToken);
        }
        public async void GetRefreshTokenByValueWithRightId()
        {
            string tokenValue = "tokenValue";
            var    token      = new RefreshToken
            {
                TokenValue = tokenValue,
                UserId     = "id"
            };

            _repo.GetRefreshTokenByValue(tokenValue).Returns(token);

            RefreshTokenService refreshService = new RefreshTokenService(_repo);

            var result = await refreshService.GetRefreshTokenByValue(tokenValue);

            Assert.NotNull(result);
            Assert.IsType <RefreshToken>(result);
            Assert.NotNull(result.TokenValue);
            Assert.NotNull(result.UserId);
            Assert.Equal(result.TokenValue, tokenValue);
        }