示例#1
0
        public AutomationDataFactory(DataFactoryConfiguration configuration, TestShippingAuthCredential testShippingAuthCredential)
        {
            //empties and nulls validation
            ApiUrlHelper.ValidateUrl(configuration.IntegrationsApiUrl, nameof(configuration.IntegrationsApiUrl));
            ApiUrlHelper.ValidateUrl(configuration.ShippingServiceApiUrl, nameof(configuration.ShippingServiceApiUrl));

            //clean service api url
            string integrationsApiUrl    = ApiUrlHelper.GetRequesterFormatUrl(configuration.IntegrationsApiUrl);
            string shippingServiceApiUrl = ApiUrlHelper.GetRequesterFormatUrl(configuration.ShippingServiceApiUrl);
            string tenantUrl             = ApiUrlHelper.GetRequesterFormatUrl(configuration.TenantSiteUrl);

            //clients initialization
            var integrationsClient    = new IntegrationsWebAppClient(integrationsApiUrl, configuration.TenantExternalIdentifier, configuration.TenantInternalIdentifier, configuration.IntegrationsApiUrl.Contains("https"));
            var shippingServiceClient = new ShippingServiceClient(shippingServiceApiUrl, configuration.TenantExternalIdentifier, configuration.ShippingServiceApiUrl.Contains("https"));

            //dependencies setup
            var usersProcessor = new UserAccountsProcessor(integrationsClient);

            Users = new UserAccountsFactory(usersProcessor);

            var shippingProcessor = new ShippingServiceProcessor(shippingServiceClient, configuration.ShippingServiceApiUrl, configuration.TenantExternalIdentifier);

            Shipping = new ShippingConfigurationFactory(shippingProcessor, testShippingAuthCredential);

            var productsProcessor = new MerchandiseProcessor(integrationsClient);

            Products = new ProductsFactory(productsProcessor, tenantUrl);
        }
示例#2
0
        public void AddPackage_importdata_PackageAdded()
        {
            //arrange
            ShippingService.ShippingServiceClient shippingserviceclient = new ShippingServiceClient();
            //act
            ShippingService.Package package = new ShippingService.Package();

            package.Address = new ShippingService.Address();

            package.Address.City = "Vienna";
            package.Address.Country = "Austria";
            package.Address.PostalCode = "1010";
            package.Address.Street = "Kärntnerstraße";
            package.Address.Id = 1;
            package.Id = 1;

            shippingserviceclient.AddPackage(package);

            //assert
            Assert.IsFalse(false);
        }
示例#3
0
        public DataFactory(DataFactoryConfiguration configuration)
        {
            IIntegrationsWebAppClient integrationsClient    = null;
            IShippingServiceClient    shippingServiceClient = null;

            //empties and nulls validation
            UrlExist(configuration.IntegrationsApiUrl, nameof(configuration.IntegrationsApiUrl));
            UrlExist(configuration.ShippingServiceApiUrl, nameof(configuration.ShippingServiceApiUrl));

            string integrationsApiUrl    = FixHttpOnUrl(configuration.IntegrationsApiUrl);
            string shippingServiceApiUrl = FixHttpOnUrl(configuration.ShippingServiceApiUrl);

            //services initialization
            integrationsClient    = new IntegrationsWebAppClient(integrationsApiUrl, configuration.TenantExternalIdentifier, configuration.TenantInternalIdentifier, configuration.IntegrationsApiUrl.Contains("https"));
            shippingServiceClient = new ShippingServiceClient(shippingServiceApiUrl, configuration.TenantExternalIdentifier, configuration.ShippingServiceApiUrl.Contains("https"));

            //dependencies initialization
            UserAccounts = new TestUserAccountsFactory(integrationsClient);
            Addresses    = new TestAddressesFactory(integrationsClient);
            ShippingConfigurationPreferences = new TestShippingConfigurationFactory(shippingServiceClient);
            ShippingRates = new TestShippingRatesFactory(shippingServiceClient);
        }