Exemplo n.º 1
0
        public void TestCoop()
        {
            CoopDoStuff coop = new CoopDoStuff("f0cabde6bb8d4bd78c28270ee203253f");

            coopProduct = coop.CoopFindEverythingInStore("24073");

            Assert.IsTrue(coopProduct.Count > 1);
        }
Exemplo n.º 2
0
        public async Task GenerateData(bool coop, bool webcrawler, bool generatePrice, bool DeleteRefrences, bool autocomplete)
        {
            ProductHandling productHandling = new ProductHandling();

            if (coop)
            {
                CoopDoStuff tryCoop = new CoopDoStuff("d0b9a5266a2749cda99d4468319b6d9f");

                List <CoopProduct> coopProducts = tryCoop.CoopFindEverythingInStore("24073");
                int count = 0;
                foreach (CoopProduct c in coopProducts)
                {
                    count++;
                    Console.WriteLine(count);
                    await dc.Product.Add(new Product("F" + c.Ean, c.Navn, c.Navn2, c.Pris, "", "Fakta"));
                }
            }

            if (webcrawler)
            {
                RecipeCrawl WebRunner = new RecipeCrawl();
                _ = WebRunner.GetRecipes(100, 2884, dc);

                Console.WriteLine("web runner begins... fear its power");
                Console.ReadKey();
            }

            if (generatePrice)
            {
                await dc.Recipe.GenerateCheapestPL();

                await dc.Recipe.PopulateIngredientLink();
            }

            if (DeleteRefrences)
            {
                List <Product> products = dc.Product.GetList("");

                foreach (Product product in products)
                {
                    _ = dc.Product.AddReference("", product._id);
                }
            }

            if (autocomplete)
            {
                await dc.Product.AddAutocompleteToDB();
            }
        }