예제 #1
0
        public async Task BuildSortedProductListAToZTest()
        {
            var productListService = new ProductListService();
            var productList        = await productListService.BuildProductList("Ascending");

            var expectedResult = new List <Product>()
            {
                { new Product {
                      Name = "Test Product A", Price = 99.99, Quantity = 0.0
                  } },
                { new Product {
                      Name = "Test Product B", Price = 101.99, Quantity = 0.0
                  } },
                { new Product {
                      Name = "Test Product C", Price = 10.99, Quantity = 0.0
                  } },
                { new Product {
                      Name = "Test Product D", Price = 5.0, Quantity = 0.0
                  } },
                { new Product {
                      Name = "Test Product F", Price = 999999999999.0, Quantity = 0.0
                  } }
            };

            try
            {
                Assert.NotNull(productListService);
                Assert.IsInstanceOf <List <Product> >(productList);
                Assert.AreEqual(JsonConvert.SerializeObject(productList), JsonConvert.SerializeObject(expectedResult));
            }
            catch (AssertionException e)
            {
                System.Diagnostics.Debug.WriteLine(e);
            }
        }
        public async Task GetDisplayValues(string Uri)
        {
            var productListServices = new ProductListService();
            var list = await productListServices.GetProductsAsync(Uri);

            ProductsList = new List <ProductModel>();
            foreach (ProductDataModel product in list)
            {
                if (product.Quantity > 0)
                {
                    var singleProduct = new ProductModel
                    {
                        ID   = product.ID,
                        Name = product.Manufacturer +
                               " " + product.Model,
                        Processor = product.Specs.Processor,
                        RAM       = product.Specs.RAM + " GB RAM",
                        Storage   = product.Specs.Disk_size +
                                    " GB " + product.Specs.Disk_type,
                        Price = "CENA: \n" + (int)product.Price + " zł",
                        Img   = product.Image.Image
                    };
                    ProductsList.Add(singleProduct);
                }
            }
            IsBusy = false;
        }
예제 #3
0
 public ProductCatalogStructurePackage(BaseProductService baseProductService, ProductListService productListService,
                                       RelationshipTypeService relationshipTypeService, CategoryService categoryService,
                                       UnitOfMeasurementService unitOfMeasurementService, DataService dataService,
                                       FieldTemplateService fieldTemplateService,
                                       LanguageService languageService, VariantService variantService,
                                       InventoryService inventoryService,
                                       PriceListService priceListService,
                                       StructureInfoService structureInfoService,
                                       CurrencyService currencyService,
                                       FilterService filterService,
                                       InventoryItemService inventoryItemService,
                                       PriceListItemService priceListItemService,
                                       ProductListItemService productListItemService)
 {
     _baseProductService        = baseProductService;
     _categoryService           = categoryService;
     _dataService               = dataService;
     _fieldTemplateService      = fieldTemplateService;
     _languageService           = languageService;
     _variantService            = variantService;
     _inventoryService          = inventoryService;
     _priceListService          = priceListService;
     _structureInfoService      = structureInfoService;
     _currencyService           = currencyService;
     _filterService             = filterService;
     _productListService        = productListService;
     _relationshipTypeService   = relationshipTypeService;
     _unitOfMeasurementService  = unitOfMeasurementService;
     _bidirectionalRelationList = new List <ImportBidirectionalRelation>();
     _inventoryItemService      = inventoryItemService;
     _priceListItemService      = priceListItemService;
     _productListItemService    = productListItemService;
 }
예제 #4
0
 public frmProducts()
 {
     InitializeComponent();
     Service             = new ProductListService();
     Limit               = 15;
     btnPrevious.Enabled = false;
 }
예제 #5
0
        public async Task <IActionResult> GetProductsInSortedOrder()
        {
            if (Request.Query.TryGetValue("sortOption", out StringValues val))
            {
                var sortOption         = val.ToString();
                var productListBuilder = new ProductListService();
                var productList        = await productListBuilder.BuildProductList(sortOption);

                return(new ObjectResult(value: productList));
            }
            else
            {
                Response.StatusCode = 400;
                return(Content("sortOption Query Parameter is required."));
            }
        }
 public ProductIndexDocumentBuilder(
     IndexDocumentBuilderDependencies dependencies,
     BaseProductService baseProductService,
     DisplayTemplateService displayTemplateService,
     FieldTemplateService fieldTemplateService,
     VariantService variantService,
     TemplateSettingService templateSettingService,
     ProductIndexingContext productIndexingContext,
     CategoryService categoryService,
     MostSoldDataHolder mostSoldDataHolder,
     CampaignDataHolder campaignDataHolder,
     CountryService countryService,
     PriceListService priceListService,
     PriceListItemService priceListItemService,
     ProductListService productListService,
     ProductListItemService productListItemService,
     FilterService filterService,
     FieldDefinitionService fieldDefinitionService,
     SearchPermissionService searchPermissionService,
     ContentBuilderService contentBuilderService,
     ChannelService channelService,
     LanguageService languageService)
     : base(dependencies)
 {
     _baseProductService      = baseProductService;
     _displayTemplateService  = displayTemplateService;
     _fieldTemplateService    = fieldTemplateService;
     _variantService          = variantService;
     _templateSettingService  = templateSettingService;
     _productIndexingContext  = productIndexingContext;
     _categoryService         = categoryService;
     _mostSoldDataHolder      = mostSoldDataHolder;
     _campaignDataHolder      = campaignDataHolder;
     _countryService          = countryService;
     _priceListService        = priceListService;
     _priceListItemService    = priceListItemService;
     _productListService      = productListService;
     _productListItemService  = productListItemService;
     _filterService           = filterService;
     _fieldDefinitionService  = fieldDefinitionService;
     _searchPermissionService = searchPermissionService;
     _contentBuilderService   = contentBuilderService;
     _channelService          = channelService;
     _languageService         = languageService;
 }
 public void Setup()
 {
     productDetailService = new ProductDetailService();
     productListService   = new ProductListService();
 }
예제 #8
0
 public ProductServiceTests()
 {
     Sut = new ProductListService();
 }