示例#1
0
            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));
            }
示例#2
0
            public async Task ShouldCreateAUserLoginWithTheGivenInfo(
                Snowflake discordUserId,
                Guid identityUserId,
                string accessToken,
                [Frozen, Substitute] IUsersClient usersClient,
                [Target] DefaultUserService service,
                CancellationToken cancellationToken
                )
            {
                await service.LinkDiscordIdToUser(discordUserId, identityUserId, accessToken, cancellationToken);

                await usersClient.Received().CreateLogin(
                    Is(identityUserId),
                    Is <CreateUserLoginRequest>(userLogin =>
                                                userLogin.LoginProvider == "discord" &&
                                                userLogin.ProviderKey == discordUserId
                                                ),
                    Is(cancellationToken)
                    );
            }