public ProductsReturn GetProductsByCategory(UserSelectedContext catalogInfo, string category, SearchInputModel searchModel, UserProfile profile) { ProductsReturn ret; string categoryName = _catalogLogic.GetCategoryName(category, searchModel); UserSelectedContext newCatalog = new UserSelectedContext { CustomerId = catalogInfo.CustomerId, BranchId = _catalogLogic.GetBranchId(catalogInfo.BranchId, searchModel.CatalogType) }; List <string> specialFilters = _catalogRepository.SeekSpecialFilters(searchModel.Facets); // special handling for price sorting if (searchModel.SField == "caseprice") // we have to block caseprice from the searchModel used in es { ret = _catalogRepository.GetProductsByCategory(newCatalog, categoryName, new SearchInputModel { Facets = searchModel.Facets, From = searchModel.From, Size = searchModel.Size }); } else if (specialFilters.Count > 0) { ret = GetAllCategoryProductsShallow(searchModel, categoryName, newCatalog); } else { ret = _catalogRepository.GetProductsByCategory(newCatalog, categoryName, searchModel); } ret = ApplySpecialFilters(catalogInfo, profile, specialFilters, searchModel, ret); AddPricingInfo(ret, catalogInfo, searchModel); GetAdditionalProductInfo(profile, ret, catalogInfo); return(ret); }
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); }