Beispiel #1
0
        public async Task GetManagementClientAsync_ShouldSucceed()
        {
            var auth0FactoryOptions = new Auth0FactoryOptions
            {
                Domain           = Environment.GetEnvironmentVariable("E2E_Domain"),
                ClientId         = Environment.GetEnvironmentVariable("E2E_ClientId"),
                ClientSecret     = Environment.GetEnvironmentVariable("E2E_ClientSecret"),
                ReuseAccessToken = false
            };

            if (auth0FactoryOptions.Domain == null ||
                auth0FactoryOptions.ClientId == null ||
                auth0FactoryOptions.ClientSecret == null)
            {
                Assert.Fail("Environment variables are not configured correctly.");
            }

            var accessTokenFactory = new Auth0AccessTokenFactory(auth0FactoryOptions);
            var clientFactory      = new Auth0ClientFactory(auth0FactoryOptions, accessTokenFactory);
            var client             = await clientFactory.GetManagementApiClientAsync();

            var getUsersRequest = new GetUsersRequest();
            var users           = await client.Users.GetAllAsync(getUsersRequest);

            Assert.IsNotNull(users);
            Assert.AreEqual(0, users.Count);
        }
        public void Initialize()
        {
            domain = Guid.NewGuid().ToString();
            mockAccessTokenFactory = new Mock <IAuth0AccessTokenFactory>();

            clientFactory = new Auth0ClientFactory(
                domain,
                mockAccessTokenFactory.Object);
        }