/// <summary> /// Permet de récupérer un RefreshToken via l'id d'un utilisateur /// </summary> /// <param name="userId"></param> /// <returns>RefreshToken</returns> public async Task <RefreshToken> GetRefreshTokenByUserId(string userId) { RefreshToken token = null; if (!String.IsNullOrWhiteSpace(userId)) { token = await _repo.GetRefreshTokenByUserId(userId); } return(token); }
public async void GetRefreshTokenByUserIdWithRightId() { string id = "id"; var token = new RefreshToken { TokenValue = "token", UserId = id }; _repo.GetRefreshTokenByUserId(id).Returns(token); RefreshTokenService refreshService = new RefreshTokenService(_repo); var result = await refreshService.GetRefreshTokenByUserId(id); Assert.NotNull(result); Assert.IsType <RefreshToken>(result); Assert.NotNull(result.TokenValue); Assert.NotNull(result.UserId); Assert.Equal(result.UserId, id); }