Пример #1
0
        public async Task <HttpResponseMessage> CreateProductAsync(ImportProductInformation productData)
        {
            var factory = new HttpClientFactory();

            using var client = factory.CreateHttpClient();
            return(await client.PostAsJsonAsync("api/products", productData));
        }
        public void ImportProduct(IList <ProductLine> productLines)
        {
            var productData = new ImportProductInformation
            {
                UniqueMessageId = Guid.NewGuid().ToString(),
                Lines           = productLines
            };

            var grData = ApiDataFactory.ApiDataFactory.Instance.CreateProductAsync(productData).Result;

            if (grData.IsSuccessStatusCode)
            {
                return;
            }

            Assert.Fail("The product(s) are not Imported");
        }