Exemple #1
0
        static public ITestDataFactory SetPlatform(TenantsEnum tenant)
        {
            DataFactoryConfiguration configuration = new DataFactoryConfiguration
            {
                IntegrationsApiUrl    = ServiceConstants.IntegrationsAPIUrl,
                ShippingServiceApiUrl = ServiceConstants.ShippingServiceApiUrl
            };

            switch (tenant)
            {
            case TenantsEnum.AllPoints:
                configuration.TenantExternalIdentifier = ServiceConstants.AllPointsPlatformExtId;
                configuration.TenantInternalIdentifier = ServiceConstants.AllPointsPlatformId;
                break;

            case TenantsEnum.Fmp:
                configuration.TenantExternalIdentifier = ServiceConstants.FmpPlatformExtId;
                configuration.TenantInternalIdentifier = ServiceConstants.FMPPlatformId;
                break;

            default:
                throw new ArgumentException($"{tenant} is invalid");
            }

            //initialize the factory tool (unit of work)
            return(new DataFactory(configuration));
        }
Exemple #2
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);
        }
Exemple #3
0
        public AllpointsShippingDataFactoryTest()
        {
            var config = new DataFactoryConfiguration
            {
                IntegrationsApiUrl       = ServiceConstants.IntegrationsAPIUrl,
                ShippingServiceApiUrl    = ServiceConstants.ShippingServiceApiUrl,
                TenantExternalIdentifier = ServiceConstants.AllPointsPlatformExtId,
                TenantInternalIdentifier = ServiceConstants.AllPointsPlatformId
            };

            DataFactory = new AutomationDataFactory(config);
        }
Exemple #4
0
        public AllPointsBaseTest()
        {
            DataFactoryConfiguration configuration = new DataFactoryConfiguration
            {
                IntegrationsApiUrl       = EnvironmentConstants.IntegrationsApiUrl,
                TenantExternalIdentifier = EnvironmentConstants.AllPointsPlatformExtId,
                TenantInternalIdentifier = EnvironmentConstants.AllPointsPlatformId,
                ShippingServiceApiUrl    = EnvironmentConstants.ShippingServiceApiUrl
            };

            Url         = EnvironmentConstants.AllPointsWebAppUrl;
            DataFactory = new AutomationDataFactory(configuration);
        }
Exemple #5
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);
        }