Exemple #1
0
        public void SKUFormatter_get_correct_result_1()
        {
            int sku1     = 3392393;
            var expected = "000000000003392393";
            var actual   = skuFormatter.GetFormattedSKUString(sku1);

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public async Task <ProductDetails> GetProductDetailsBySKUAsync(string productDetailsUrl, string urlParams, int sku)
        {
            var formattedSKU = skuFormatter.GetFormattedSKUString(sku);
            var productUrl   = $"{productDetailsUrl}{urlParams}{formattedSKU}";

            var downloadTask = await httpClient.DownloadDocumentAsyn(productUrl);

            var content = downloadTask;

            contentReader.SetContext(content);

            var productDetails = new ProductDetails();

            productDetails.SKU      = sku;
            productDetails.Url      = productUrl;
            productDetails.Title    = contentReader.ReadContent("<title>", " - Product Details").Trim();
            productDetails.ImageUrl = contentReader.ReadContent("<a class=\"change-cursor\" href=\"", "\">").Trim();

            return(productDetails);
        }