public void NotBekBranchId_GetBranchIdReturnsSameBranchId() { // arrange ICatalogLogic testLogic = MakeMockLogic(); UserSelectedContext catalogInfo = new UserSelectedContext() { BranchId = "FRT?", CustomerId = "123456" }; string search = "hotdog"; SearchInputModel searchModel = new SearchInputModel { From = 1, Size = 1, Facets = "testfacet", SField = "testSField", SDir = "testSDir", CatalogType = "testCatalogType", Dept = "testDept" }; Dictionary <string, int> expected = new Dictionary <string, int>(); expected.Add("FRT?", 10); expected.Add("BEK", 10); // act Dictionary <string, int> results = testLogic.GetHitsForCatalogs(catalogInfo, search, searchModel); // assert results.Count.Should().Be(2); }
public void GoodParams_ReturnsProducts() { // arrange ICatalogLogic testLogic = MakeMockLogic(); UserSelectedContext testContext = new UserSelectedContext() { BranchId = "FUT", CustomerId = "123456" }; String search = "hotdog"; SearchInputModel searchModel = new SearchInputModel() { From = 0, Size = 1, Facets = "", SField = "", SDir = "", CatalogType = "", Dept = "" }; // act ProductsReturn results = testLogic.GetProductsBySearch(testContext, search, searchModel, null); // assert results.Products.Count().Should().Be(1); }
public OrderConversionLogicImpl(IOrderHistoryHeaderRepsitory historyRepository, IUnitOfWork unitOfWork, IEventLogRepository logRepo, ICatalogLogic catalogLogic) { _historyRepo = historyRepository; _uow = unitOfWork; _catalogLogic = catalogLogic; _log = logRepo; }
public void GoodItem_GetProductsByItemNumberReturnsProductImages() { // arrange int expected = 1; ICatalogLogic testLogic = MakeMockLogic(); Mock <ICatalogRepository> testRepo = new Mock <ICatalogRepository>(); List <string> testItemNumbers = new List <string> { "555555" }; UserSelectedContext testContext = new UserSelectedContext { BranchId = "FUT", CustomerId = "123456" }; // act ProductsReturn results = testLogic.GetProductsByItemNumbers(testContext, testItemNumbers, new SearchInputModel(), new UserProfile()); // assert results.Products .First() .ProductImages.Count() .Should() .Be(expected); }
public ImportServiceImpl(ICatalogLogic catalogLogic) { this.catalogLogic = catalogLogic; _errors = new StringBuilder(); _warnings = new StringBuilder(); }
public ReportLogic(ICatalogRepository catalogRepository, IReportRepository reportRepository, IEventLogRepository eventLogRepository, ICatalogLogic catalogLogic) { _catalogLogic = catalogLogic; _catalogRepository = catalogRepository; _log = eventLogRepository; _reportRepository = reportRepository; }
public static void GetItemOrderHistories(ICatalogLogic catalogLogic, UserSelectedContext catalogInfo, List <InvoiceItemModel> prods) { foreach (var prod in prods) { StringBuilder sbHistory = BuildItemHistory(catalogLogic, catalogInfo, prod.ItemNumber); prod.OrderHistoryString = sbHistory.ToString(); } }
/// <summary> /// ctor /// </summary> /// <param name="shoppingCartLogic"></param> /// <param name="profileLogic"></param> /// <param name="logRepo"></param> /// <param name="userActiveCartLogic"></param> /// <param name="exportSettingsLogic"></param> /// <param name="cartService"></param> /// <param name="catalogLogic"></param> /// <param name="listService"></param> public ShoppingCartController(IShoppingCartLogic shoppingCartLogic, IUserProfileLogic profileLogic, IEventLogRepository logRepo, IListService listService, ICatalogLogic catalogLogic, IUserActiveCartLogic userActiveCartLogic, IExportSettingLogic exportSettingsLogic, IShoppingCartService cartService) : base(profileLogic) { _activeCartLogic = userActiveCartLogic; _shoppingCartLogic = shoppingCartLogic; _exportLogic = exportSettingsLogic; _listService = listService; _catalogLogic = catalogLogic; _log = logRepo; _shoppingCartService = cartService; }
public ContractListChangesLogicImpl(ICatalogLogic catalogLogic, ICustomerRepository customerRepository, IEventLogRepository eventLogRepository, IGenericQueueRepository queueRepository, IContractChangesRepository contractChangesRepo, IMessageTemplateLogic messageTemplateLogic) { _catalogLogic = catalogLogic; _customerRepo = customerRepository; _log = eventLogRepository; _queueRepo = queueRepository; _contractChangesRepo = contractChangesRepo; _messageTemplateLogic = messageTemplateLogic; }
/// <summary> /// constructor /// </summary> /// <param name="reportLogic"></param> /// <param name="profileLogic"></param> /// <param name="exportSettingsLogic"></param> /// <param name="inventoryValuationReportLogic"></param> /// <param name="logRepo"></param> public ReportController(IReportLogic reportLogic, IUserProfileLogic profileLogic, IExportSettingLogic exportSettingsLogic, ICatalogLogic catalogLogic, IInventoryValuationReportLogic inventoryValuationReportLogic, IListService listService, IEventLogRepository logRepo) : base(profileLogic) { _exportLogic = exportSettingsLogic; _inventoryValuationReportLogic = inventoryValuationReportLogic; _reportLogic = reportLogic; _listService = listService; _catalogLogic = catalogLogic; _log = logRepo; }
public ETLService(ICatalogLogic categoryLogic, ICustomerLogic customerLogic, ICategoriesImport esCategoriesImport, IHouseBrandsImport esHouseBrandsImport, IItemImport esItemImport, IListsImportLogic listImportLogic, IEventLogRepository log) { this.categoryLogic = categoryLogic; this.customerLogic = customerLogic; this._esCategoriesImportLogic = esCategoriesImport; this._esHouseBrandsImportLogic = esHouseBrandsImport; this._esItemImportLogic = esItemImport; this._listImportLogic = listImportLogic; this._log = log; }
public void BadCatalogId_ReturnsFalse() { // arrange ICatalogLogic testLogic = MakeMockLogic(); String catalogId = "bek"; // act bool results = testLogic.IsCatalogIdBEK(catalogId); // assert results.Should().Be(false); }
public void GoodCatalogId_ReturnsTrue() { // arrange ICatalogLogic testLogic = MakeMockLogic(); String catalogId = "FRT?"; // act bool results = testLogic.IsCatalogIdBEK(catalogId); // assert results.Should().Be(true); }
private List <Core.Models.SiteCatalog.Pricing.PowerMenu.Product> GetItemPricing(string branchId, string customerNumber, List <ProductLine> products, DateTime effectiveDate) { List <Core.Models.SiteCatalog.Pricing.PowerMenu.Product> retVal = new List <Core.Models.SiteCatalog.Pricing.PowerMenu.Product>(); List <string> itemNumbers = (from ProductLine p in products select p.ProductNumber).ToList(); ICatalogLogic catLogic = _scope.GetService(typeof(ICatalogLogic)) as ICatalogLogic; ProductsReturn items = catLogic.GetProductsByIdsWithPricing(new UserSelectedContext() { BranchId = branchId, CustomerId = customerNumber }, itemNumbers); foreach (Svc.Core.Models.SiteCatalog.Product item in items.Products) { KeithLink.Svc.Core.Models.SiteCatalog.Pricing.PowerMenu.Product currentItem = new KeithLink.Svc.Core.Models.SiteCatalog.Pricing.PowerMenu.Product(); currentItem.ProductNumber = item.ItemNumber; currentItem.IsAuthorized = item.HasPrice; currentItem.IsActive = true; currentItem.AvailableQty = 0; currentItem.IsCatchWeight = item.CatchWeight; ProductLine myProduct = (from ProductLine p in products where p.ProductNumber == currentItem.ProductNumber select p).FirstOrDefault(); if (item.CatchWeight) { currentItem.Price = (decimal)item.CasePriceNumeric; currentItem.PurchaseByUnit = "lb"; } else if (myProduct.Unit.Length == 0 || myProduct.Unit.Equals("case", StringComparison.InvariantCultureIgnoreCase)) { currentItem.Price = (decimal)item.CasePriceNumeric; currentItem.PurchaseByUnit = "cs"; } else if (myProduct.Unit.Equals("each", StringComparison.InvariantCultureIgnoreCase)) { currentItem.Price = (decimal)item.PackagePriceNumeric; currentItem.PurchaseByUnit = "ea"; } else { currentItem.Price = 0; currentItem.PurchaseByUnit = string.Empty; } retVal.Add(currentItem); } return(retVal); }
public ImportLogicImpl(ICatalogLogic catalogLogic, IEventLogRepository eventLogRepository, IShoppingCartLogic shoppingCartLogic, IPriceLogic priceLogic, ICustomInventoryItemsRepository customInventoryRepo, ISiteCatalogService catalogService) { this.catalogLogic = catalogLogic; _catalogService = catalogService; this.eventLogRepository = eventLogRepository; this.shoppingCartLogic = shoppingCartLogic; this.priceLogic = priceLogic; _customInventoryRepo = customInventoryRepo; _errors = new StringBuilder(); _warnings = new StringBuilder(); }
public void EmptyIds_ReturnsNoProducts() { // arrange ICatalogLogic testLogic = MakeMockLogic(); String branch = "FRT?"; List <string> ids = new List <string>(); // act ProductsReturn results = testLogic.GetProductsByIds(branch, ids); // assert results.Products.Count().Should().Be(0); }
public void NotBekBranchId_GetBranchIdReturnsSameBranchId() { // arrange ICatalogLogic testLogic = MakeMockLogic(); String branchId = "FRT"; String catalogType = "FRTR"; // act string results = testLogic.GetBranchId(branchId, catalogType); // assert results.Should().Be(branchId); }
public void NullCatalogTypeAndBranchId_IsSpecialtyCatalogReturnsFalse() { // arrange ICatalogLogic testLogic = MakeMockLogic(); String branchId = null; String catalogType = null; // act bool results = testLogic.IsSpecialtyCatalog(catalogType, branchId); // assert results.Should().Be(false); }
public void NullCatalogType_IsSpecialtyCatalogReturnsTrues() { // arrange ICatalogLogic testLogic = MakeMockLogic(); String branchId = "FRT"; String catalogType = null; // act bool results = testLogic.IsSpecialtyCatalog(catalogType, branchId); // assert results.Should().Be(true); }
/// <summary> /// ctor /// </summary> /// <param name="profileLogic"></param> /// <param name="invoiceLogic"></param> /// <param name="exportSettingsLogic"></param> /// <param name="orderLogic"></param> /// <param name="invoiceImagingLogic"></param> /// <param name="logRepo"></param> /// <param name="invService"></param> public InvoiceController(IUserProfileLogic profileLogic, IOnlinePaymentsLogic invoiceLogic, IExportSettingLogic exportSettingsLogic, IOrderLogic orderLogic, IImagingLogic invoiceImagingLogic, IEventLogRepository logRepo, ICatalogLogic catalogLogic, IExportInvoicesService invService, IListService listService) : base(profileLogic) { _invLogic = invoiceLogic; _orderLogic = orderLogic; _exportLogic = exportSettingsLogic; _imgLogic = invoiceImagingLogic; _log = logRepo; _catalogLogic = catalogLogic; _invService = invService; _listService = listService; }
public void NotBekBranchId_IsSpecialtyCatalogReturnsTrue() { // arrange ICatalogLogic testLogic = MakeMockLogic(); String branchId = "_bek"; String catalogType = "FRTR"; // act bool results = testLogic.IsSpecialtyCatalog(catalogType, branchId); // assert results.Should().Be(true); }
/// <summary> /// ctor /// </summary> /// <param name="profileLogic"></param> /// <param name="listLogic"></param> /// <param name="exportSettingsLogic"></param> /// <param name="elRepo"></param> /// <param name="auditLogRepo"></param> /// <param name="listRepo"></param> public ListController(IUserProfileLogic profileLogic, IExportSettingLogic exportSettingsLogic, ICacheListLogic cacheListLogic, ICatalogLogic catalogLogic, IEventLogRepository elRepo, IAuditLogRepository auditLogRepo, ICustomListSharesRepository customListSharesRepo, IListService listService) : base(profileLogic) { _auditLogRepo = auditLogRepo; _cacheListLogic = cacheListLogic; _profileLogic = profileLogic; _exportLogic = exportSettingsLogic; _elRepo = elRepo; _listService = listService; _customListSharesRepo = customListSharesRepo; _catalogLogic = catalogLogic; }
/// <summary> /// constructor /// </summary> /// <param name="catalogLogic"></param> /// <param name="profileLogic"></param> /// <param name="exportSettingsLogic"></param> /// <param name="elRepo"></param> /// <param name="campaignService"></param> /// <param name="campaignLogic"></param> public CatalogController(ICatalogLogic catalogLogic, IUserProfileLogic profileLogic, IListService listService, IExportSettingLogic exportSettingsLogic, IEventLogRepository elRepo, ICatalogCampaignService campaignService, ICatalogCampaignLogic campaignLogic, ISiteCatalogService catalogService) : base(profileLogic) { _campaignLogic = campaignLogic; _campaignService = campaignService; _catalogLogic = catalogLogic; _exportSettingRepository = exportSettingsLogic; _catalogService = catalogService; _listService = listService; this._elRepo = elRepo; }
public SiteCatalogServiceImpl(ICatalogLogic catalogLogic , ICatalogRepository catalogRepository, IPriceLogic priceLogic , IHistoryListLogic historyLogic, ICategoryImageRepository categoryImageRepository , IRecommendedItemsRepository recommendedItemsRepository , IGrowthAndRecoveriesRepository growthAndRecoveryItemsRepository) { _catalogLogic = catalogLogic; _catalogRepository = catalogRepository; _priceLogic = priceLogic; _historyLogic = historyLogic; _recommendedItemsRepository = recommendedItemsRepository; _growthAndRecoveryItemsRepository = growthAndRecoveryItemsRepository; _categoryImageRepository = categoryImageRepository; }
private static CatalogCampaignServiceImpl MakeService(ICatalogLogic catalogLogic = null, ICatalogCampaignLogic campaignLogic = null, ICampaignCustomerRepository campaignCustomerRepository = null) { if (catalogLogic == null) { catalogLogic = MockCatalogLogic().Object; } if (campaignLogic == null) { campaignLogic = MockCampaignLogic().Object; } return(new CatalogCampaignServiceImpl(catalogLogic, campaignLogic)); }
public void GoodCategories_GetCategoryNameReturnsCachedCategories() { // arrange ICatalogLogic testLogic = MakeMockLogic(); // act CategoriesReturn results = testLogic.GetCategories(0, 2000, "testType"); // assert results.Categories .Count() .Should() .Be(2); }
private static StringBuilder BuildItemHistory(ICatalogLogic catalogLogic, UserSelectedContext catalogInfo, string itemNumber) { var history = catalogLogic.GetLastFiveOrderHistory(catalogInfo, itemNumber); StringBuilder sbHistory = new StringBuilder(); if (history != null) { foreach (OrderHistoryFile h in history) { foreach (OrderHistoryDetail d in h.Details) { sbHistory.Append(string.Format("{0}-{1}, ", h.Header.DeliveryDate, d.ShippedQuantity)); } } } return(sbHistory); }
public void EmptyIds_ReturnsNoProducts() { // arrange ICatalogLogic testLogic = MakeMockLogic(); UserSelectedContext testContext = new UserSelectedContext() { BranchId = "FUT", CustomerId = "123456" }; List <string> ids = new List <string>(); // act ProductsReturn results = testLogic.GetProductsByIdsWithPricing(testContext, ids); // assert results.Products.Count().Should().Be(0); }
/// <summary> /// ctor /// </summary> /// <param name="shoppingCartLogic"></param> /// <param name="orderLogic"></param> /// <param name="shipDayRepo"></param> /// <param name="historyRequestLogic"></param> /// <param name="profileLogic"></param> /// <param name="exportSettingsLogic"></param> /// <param name="logRepo"></param> /// <param name="historyHeaderRepository"></param> /// <param name="orderHistoryLogic"></param> /// <param name="cartService"></param> public OrderController(IShoppingCartLogic shoppingCartLogic, IOrderLogic orderLogic, IShipDateRepository shipDayRepo, IListService listService, ICatalogLogic catalogLogic, IOrderHistoryRequestLogic historyRequestLogic, IUserProfileLogic profileLogic, IExportSettingLogic exportSettingsLogic, IEventLogRepository logRepo, IOrderHistoryHeaderRepsitory historyHeaderRepository, IOrderHistoryLogic orderHistoryLogic, IShoppingCartService cartService) : base(profileLogic) { _historyRequestLogic = historyRequestLogic; _orderLogic = orderLogic; _shipDayService = shipDayRepo; _shoppingCartLogic = shoppingCartLogic; _exportLogic = exportSettingsLogic; _log = logRepo; _historyHeaderRepo = historyHeaderRepository; _historyLogic = orderHistoryLogic; _listService = listService; _catalogLogic = catalogLogic; _shoppingCartService = cartService; }
public void GoodBranch_ReturnsProducts() { // arrange ICatalogLogic testLogic = MakeMockLogic(); String branch = "FRT?"; List <string> ids = new List <string>() { "123456", "234567", "345678" }; // act ProductsReturn results = testLogic.GetProductsByIds(branch, ids); // assert results.Products.Count().Should().Be(2); }