public async Task ShouldCreateALoginsClientWithTheGivenToken( Snowflake discordUserId, Guid identityUserId, string accessToken, [Frozen, Substitute] IUsersClientFactory factory, [Target] DefaultUserService service, CancellationToken cancellationToken ) { await service.LinkDiscordIdToUser(discordUserId, identityUserId, accessToken, cancellationToken); factory.Received().Create(Is(accessToken)); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultUserService" /> class. /// </summary> /// <param name="userIdCache">Cache for user ID lookups.</param> /// <param name="loginProvidersClient">Client used to manage login providers and linked users in Brighid Identity.</param> /// <param name="httpClient">Client used to make arbitrary HTTP requests.</param> /// <param name="usersClientFactory">Factory for creating Brighid Identity Users clients with.</param> /// <param name="tokenHandler">The security token handler used for reading ID Token JWTs.</param> /// <param name="adapterOptions">Misc options used across adapter services.</param> /// <param name="logger">Logger used to log info to some destination(s).</param> public DefaultUserService( IUserIdCache userIdCache, ILoginProvidersClient loginProvidersClient, HttpClient httpClient, IUsersClientFactory usersClientFactory, JwtSecurityTokenHandler tokenHandler, IOptions <AdapterOptions> adapterOptions, ILogger <DefaultUserService> logger ) { this.userIdCache = userIdCache; this.loginProvidersClient = loginProvidersClient; this.usersClientFactory = usersClientFactory; this.tokenHandler = tokenHandler; this.httpClient = httpClient; this.adapterOptions = adapterOptions.Value; this.logger = logger; }