private KonturExternTestContext(ILog log, AuthTestData authTestData, Credentials credentials, Action <ExternBuilder.Configured>?overrideOptions = null)
 {
     this.log          = log;
     this.authTestData = authTestData;
     this.credentials  = credentials;
     konturExtern      = CreateExtern(overrideOptions);
 }
            protected BaseTests(ITestOutputHelper output)
            {
                var testData = AuthTestData.LoadFromJsonFile();
                var log      = new TestLog(output);

                RequestFactory = new OpenIdRequestFactory(testData);
                OpenIdClient   = OpenIdClientFactory.CreateTestClient(testData.OpenIdServer, log);
            }
            protected private IAuthenticator CreateAuthenticator(Func <OpenIdAuthenticatorBuilder.SpecifyAuthStrategy, AuthTestData, OpenIdAuthenticatorBuilder.Configured> strategyFactory)
            {
                var testData = AuthTestData.LoadFromJsonFile();

                return(new OpenIdAuthenticatorBuilder(new WinApiCrypt(), log)
                       .WithHttpConfiguration(new TestingHttpClientConfiguration(testData.OpenIdServer))
                       .WithClientIdentification(testData.ClientId, testData.ApiKey)
                       .WithAuthenticationStrategy(x => strategyFactory(x, testData))
                       .SubstituteStopwatch(stopwatchMock.StopwatchFactory)
                       .Build());
            }
        public IsolatedAccountEnvironment(IMessageSink messageSink)
        {
            authTestData = AuthTestData.LoadFromJsonFile();
            IResponseCache responseCache = authTestData.TestDataGenerateLevel switch
            {
                TestDataGenerationLevel.TestRun => new EmptyCache(),
                TestDataGenerationLevel.TempFolder => JsonFileResponseCache.InTempFolder(),
                TestDataGenerationLevel.CurrentDirectory => JsonFileResponseCache.InCurrentFolder(),
                _ => throw new ArgumentOutOfRangeException(nameof(authTestData.TestDataGenerateLevel), authTestData.TestDataGenerateLevel, null)
            };
            var log = new TestLog(messageSink);

            lifetime       = new Lifetime(log);
            externTestTool = new ExternTestTool(authTestData.ApiKey, responseCache, lifetime, log);
        }
 public OpenIdRequestFactory(AuthTestData testData) => this.testData = testData;
 private static OpenIdAuthenticatorBuilder.Configured CreateStrategy(OpenIdAuthenticatorBuilder.SpecifyAuthStrategy builder, AuthTestData authTestData) =>
 builder.WithAuthenticationByPassword(authTestData.UserName, authTestData.Password);
 private static OpenIdAuthenticatorBuilder.Configured CreateStrategy(OpenIdAuthenticatorBuilder.SpecifyAuthStrategy builder, AuthTestData authTestData) =>
 builder.WithAuthenticationByCertificate(authTestData.CertificateThumbprint);
Example #8
0
 public static ExternBuilder.Configured WithTestOpenIdAuthenticator(this ExternBuilder.SpecifyAuthenticator specifyAuthenticator, AuthTestData authTestData, Credentials credentials) =>
 specifyAuthenticator.WithOpenIdAuthenticator(builder => builder
                                              .WithHttpConfiguration(new TestingHttpClientConfiguration(authTestData.OpenIdServer))
                                              .WithClientIdentification(authTestData.ClientId, authTestData.ApiKey)
                                              .WithAuthenticationByPassword(credentials.UserName, credentials.Password)
                                              .Build()
                                              );
 public KonturExternTestContext(ITestOutputHelper output, AuthTestData authTestData, Credentials credentials, Action <ExternBuilder.Configured>?overrideOptions = null)
     : this(new TestLog(output), authTestData, credentials, overrideOptions)
 {
 }