Пример #1
0
        public ProfileUnitTests()
        {
            __profileClientInterface = Substitute.For <IProfileClient>();


            _profileClient = new ProfileClient();
        }
 public void InitClass()
 {
     this.EnsureTestApiKey();
     this._paymentClient       = new PaymentClient(this.ApiTestKey);
     this._paymentMethodClient = new PaymentMethodClient(this.ApiTestKey);
     this._refundClient        = new RefundClient(this.ApiTestKey);
     this._subscriptionClient  = new SubscriptionClient(this.ApiTestKey);
     this._mandateClient       = new MandateClient(this.ApiTestKey);
     this._customerClient      = new CustomerClient(this.ApiTestKey);
     this._profileClient       = new ProfileClient(this.ApiTestKey);
 }
Пример #3
0
        public BaseApiTestFixture()
        {
            EnsureTestApiKey();

            PaymentClient       = new PaymentClient(this.ApiTestKey);
            PaymentMethodClient = new PaymentMethodClient(this.ApiTestKey);
            RefundClient        = new RefundClient(this.ApiTestKey);
            IssuerClient        = new IssuerClient(this.ApiTestKey);
            SubscriptionClient  = new SubscriptionClient(this.ApiTestKey);
            MandateClient       = new MandateClient(this.ApiTestKey);
            CustomerClient      = new CustomerClient(this.ApiTestKey);
            ProfileClient       = new ProfileClient(this.ApiTestKey);
        }
Пример #4
0
        public BaseApiTestFixture()
        {
            EnsureTestApiKey();

            ClientService       = new ClientService(ApiTestKey);
            PaymentClient       = new PaymentClient(ClientService);
            PaymentMethodClient = new PaymentMethodClient(ClientService);
            RefundClient        = new RefundClient(ClientService);
            SubscriptionClient  = new SubscriptionClient(ClientService);
            MandateClient       = new MandateClient(ClientService);
            CustomerClient      = new CustomerClient(ClientService);
            ProfileClient       = new ProfileClient(ClientService);
            OrderClient         = new OrderClient(ClientService);
        }
Пример #5
0
        public void InitClass()
        {
            string apiKey = this.GetApiKeyFromConfiguration();

            this.EnsureTestApiKey(apiKey);

            this._paymentClient       = new PaymentClient(apiKey);
            this._paymentMethodClient = new PaymentMethodClient(apiKey);
            this._refundClient        = new RefundClient(apiKey);
            this._subscriptionClient  = new SubscriptionClient(apiKey);
            this._mandateClient       = new MandateClient(apiKey);
            this._customerClient      = new CustomerClient(apiKey);
            this._profileClient       = new ProfileClient(apiKey);
            this._orderClient         = new OrderClient(apiKey);
            this._shipmentClient      = new ShipmentClient(apiKey);
        }
Пример #6
0
        public BaseApiTestFixture()
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);

            Configuration = builder.Build();

            var services = new ServiceCollection();

            services.Configure <AppSettings>(Configuration.GetSection(nameof(AppSettings)));

            var appSettings = new AppSettings();

            Configuration.GetSection(nameof(AppSettings)).Bind(appSettings);

            services.AddHttpClient();
            services.AddSingleton <IClientService, ClientService>();
            services.AddSingleton <IJsonConverterService, JsonConverterService>();
            services.AddSingleton <IValidatorService, ValidatorService>();

            // Register all available forms
            services.AddTransient <PaymentClient>();
            services.AddTransient <PaymentMethodClient>();
            services.AddTransient <RefundClient>();
            services.AddTransient <SubscriptionClient>();
            services.AddTransient <MandateClient>();
            services.AddTransient <CustomerClient>();
            services.AddTransient <CustomerClient>();
            services.AddTransient <ProfileClient>();
            services.AddTransient <OrderClient>();

            ServiceProvider = services.BuildServiceProvider();

            ClientService       = ServiceProvider.GetRequiredService <IClientService>();
            PaymentClient       = ServiceProvider.GetRequiredService <PaymentClient>();
            PaymentMethodClient = ServiceProvider.GetRequiredService <PaymentMethodClient>();
            RefundClient        = ServiceProvider.GetRequiredService <RefundClient>();
            SubscriptionClient  = ServiceProvider.GetRequiredService <SubscriptionClient>();
            MandateClient       = ServiceProvider.GetRequiredService <MandateClient>();
            CustomerClient      = ServiceProvider.GetRequiredService <CustomerClient>();
            CustomerClient      = ServiceProvider.GetRequiredService <CustomerClient>();
            ProfileClient       = ServiceProvider.GetRequiredService <ProfileClient>();
            OrderClient         = ServiceProvider.GetRequiredService <OrderClient>();

            EnsureTestApiKey();
        }
        private void InitializeFakeObjects()
        {
            _httpClientFactoryStub = new Mock <IHttpClientFactory>();
            var linkProfileOperation   = new LinkProfileOperation(_httpClientFactoryStub.Object);
            var unlinkProfileOperation = new UnlinkProfileOperation(_httpClientFactoryStub.Object);
            var getProfilesOperation   = new GetProfilesOperation(_httpClientFactoryStub.Object);

            _profileClient = new ProfileClient(linkProfileOperation, unlinkProfileOperation, getProfilesOperation);
            var postTokenOperation     = new PostTokenOperation(_httpClientFactoryStub.Object);
            var getDiscoveryOperation  = new GetDiscoveryOperation(_httpClientFactoryStub.Object);
            var introspectionOperation = new IntrospectOperation(_httpClientFactoryStub.Object);
            var revokeTokenOperation   = new RevokeTokenOperation(_httpClientFactoryStub.Object);

            _clientAuthSelector = new ClientAuthSelector(
                new TokenClientFactory(postTokenOperation, getDiscoveryOperation),
                new IntrospectClientFactory(introspectionOperation, getDiscoveryOperation),
                new RevokeTokenClientFactory(revokeTokenOperation, getDiscoveryOperation));
        }