protected WorkContext GetTestWorkContext() { var apiClientCfg = new Client.Client.Configuration(GetApiClient()); var storeApi = new StoreModuleApi(apiClientCfg); var commerceApi = new CommerceCoreModuleApi(apiClientCfg); var allStores = storeApi.StoreModuleGetStores().Select(x => x.ToWebModel()); var defaultStore = allStores.FirstOrDefault(x => string.Equals(x.Id, "Electronics", StringComparison.InvariantCultureIgnoreCase)); var currencies = commerceApi.CommerceGetAllCurrencies().Select(x => x.ToWebModel(defaultStore.DefaultLanguage)); defaultStore.SyncCurrencies(currencies, defaultStore.DefaultLanguage); var retVal = new WorkContext { AllCurrencies = defaultStore.Currencies, CurrentLanguage = defaultStore.DefaultLanguage, CurrentCurrency = defaultStore.DefaultCurrency, CurrentStore = defaultStore, CurrentCart = new Model.Cart.ShoppingCart(defaultStore.DefaultCurrency, defaultStore.DefaultLanguage), CurrentCustomer = new CustomerInfo { Id = Guid.NewGuid().ToString() } }; return(retVal); }
private IQuoteRequestBuilder GetQuoteRequestBuilder() { var apiClientConfiguration = new Client.Client.Configuration(GetApiClient()); var quoteApi = new QuoteModuleApi(apiClientConfiguration); var cacheManager = new Mock <ILocalCacheManager>(); var quoteRequestEventPublisher = new Mock <IEventPublisher <QuoteRequestUpdatedEvent> >(); return(new QuoteRequestBuilder(quoteApi, cacheManager.Object, quoteRequestEventPublisher.Object)); }
private ICatalogSearchService GetCatalogSearchService() { var apiClientConfiguration = new Client.Client.Configuration(GetApiClient()); var workContextFactory = new Func <WorkContext>(GetTestWorkContext); var catalogApi = new CatalogModuleApi(apiClientConfiguration); var pricingApi = new PricingModuleApi(apiClientConfiguration); var pricingService = new PricingServiceImpl(workContextFactory, pricingApi); var inventoryApi = new InventoryModuleApi(apiClientConfiguration); var searchApi = new SearchModuleApi(apiClientConfiguration); var marketingApi = new MarketingModuleApi(apiClientConfiguration); var promotionEvaluator = new PromotionEvaluator(marketingApi); return(new CatalogSearchServiceImpl(workContextFactory, catalogApi, pricingService, inventoryApi, searchApi, promotionEvaluator)); }
private ICartBuilder GetCartBuilder() { var apiClientCfg = new Client.Client.Configuration(GetApiClient()); var marketingApi = new MarketingModuleApi(apiClientCfg); var cartApi = new ShoppingCartModuleApi(apiClientCfg); var cacheManager = new Moq.Mock<ICacheManager<object>>(); var workContextFactory = new Func<WorkContext>(GetTestWorkContext); var promotionEvaluator = new PromotionEvaluator(marketingApi); var catalogModuleApi = new CatalogModuleApi(apiClientCfg); var pricingApi = new PricingModuleApi(apiClientCfg); var pricingService = new PricingServiceImpl(workContextFactory, pricingApi); var inventoryApi = new InventoryModuleApi(apiClientCfg); var searchApi = new SearchModuleApi(apiClientCfg); var catalogSearchService = new CatalogSearchServiceImpl(workContextFactory, catalogModuleApi, pricingService, inventoryApi, searchApi, promotionEvaluator); var retVal = new CartBuilder(cartApi, promotionEvaluator, catalogSearchService, cacheManager.Object); return retVal; }
private ICartBuilder GetCartBuilder() { var apiClientCfg = new Client.Client.Configuration(GetApiClient()); var marketingApi = new MarketingModuleApi(apiClientCfg); var cartApi = new ShoppingCartModuleApi(apiClientCfg); var cacheManager = new Moq.Mock <ICacheManager <object> >(); var workContextFactory = new Func <WorkContext>(GetTestWorkContext); var promotionEvaluator = new PromotionEvaluator(marketingApi); var catalogModuleApi = new CatalogModuleApi(apiClientCfg); var pricingApi = new PricingModuleApi(apiClientCfg); var pricingService = new PricingServiceImpl(workContextFactory, pricingApi); var inventoryApi = new InventoryModuleApi(apiClientCfg); var searchApi = new SearchModuleApi(apiClientCfg); var catalogSearchService = new CatalogSearchServiceImpl(workContextFactory, catalogModuleApi, pricingService, inventoryApi, searchApi, promotionEvaluator); var retVal = new CartBuilder(cartApi, promotionEvaluator, catalogSearchService, cacheManager.Object); return(retVal); }
protected WorkContext GetTestWorkContext() { var apiClientCfg = new Client.Client.Configuration(GetApiClient()); var storeApi = new StoreModuleApi(apiClientCfg); var commerceApi = new CommerceCoreModuleApi(apiClientCfg); var allStores = storeApi.StoreModuleGetStores().Select(x => x.ToWebModel()); var defautStore = allStores.FirstOrDefault(x => string.Equals(x.Id, "Electronics", StringComparison.InvariantCultureIgnoreCase)); var currencies = commerceApi.CommerceGetAllCurrencies().Select(x => x.ToWebModel(defautStore.DefaultLanguage)); defautStore.SyncCurrencies(currencies, defautStore.DefaultLanguage); var retVal = new WorkContext { AllCurrencies = defautStore.Currencies, CurrentLanguage = defautStore.DefaultLanguage, CurrentCurrency = defautStore.DefaultCurrency, CurrentStore = defautStore }; return retVal; }