public async Task AuthenticateWithHttpClient_Sucess(string errorMessage)
        {
            using var client = fixture.Client;
            foreach (var settings in settingsCollection)
            {
                output.WriteLine(settings.ClientId);
                using var httpClient = new HttpClient { BaseAddress = uri };
                settings.HttpClient  = client;

                string error             = null;
                var    replaceAuthHeader = errorMessage == null;
                var    authenticator     = new OidcAuthenticator(settings)
                {
                    ReplaceAuthorizationHeader = replaceAuthHeader
                };

                authenticator.OnTrace += (msg) => error = msg;
                authenticator.OnTrace += (msg) => output.WriteLine(msg);

                Assert.True(await authenticator.AuthenticateAsync(httpClient), settings.ClientId + " not authenticated");
                Assert.Equal(replaceAuthHeader, await authenticator.AuthenticateAsync(httpClient));

                Assert.Equal(errorMessage, error);
                Assert.NotNull(httpClient.DefaultRequestHeaders.Authorization);
                Assert.Equal(authenticator.Header, httpClient.DefaultRequestHeaders.Authorization);
                Assert.StartsWith("Bearer ey", httpClient.DefaultRequestHeaders.Authorization.ToString());
            }
        }
        public async Task AuthenticateOnNullObject_Exception()
        {
            var versioningManager = new OidcAuthenticator(new OidcSettings());
            ArgumentNullException ex;

            ex = await Assert.ThrowsAsync <ArgumentNullException>(() => versioningManager.AuthenticateAsync(requestMessage: null));

            Assert.Equal("requestMessage", ex.ParamName);

            ex = await Assert.ThrowsAsync <ArgumentNullException>(() => versioningManager.AuthenticateAsync(httpClient: null));

            Assert.Equal("httpClient", ex.ParamName);
        }
        public async Task GetTokenWithRefreshToken_Sucess()
        {
            using var client = fixture.Client;
            var settings = settingsCollection[1];

            using var httpClient = new HttpClient { BaseAddress = uri };
            settings.HttpClient  = client;

            string error         = null;
            var    authenticator = new OidcAuthenticator(settings);

            authenticator.OnTrace += (msg) => error = msg;
            authenticator.OnTrace += (msg) => output.WriteLine(msg);

            Assert.True(await authenticator.AuthenticateAsync(httpClient), settings.ClientId + " not authenticated");

            Assert.NotNull(httpClient.DefaultRequestHeaders.Authorization);
            Assert.StartsWith("Bearer ey", httpClient.DefaultRequestHeaders.Authorization.ToString());

            var token1 = await authenticator.GetTokenAsync(default);