예제 #1
0
        public void InitPanelCategorie()
        {
            var allProducts = categorieService.GetAllCategories();
            var newX        = initialX;
            var newY        = initialY;

            var i = 0;

            foreach (var product in allProducts)
            {
                PanelCategorie panel = new PanelCategorie();
                //panel.lblId.Text = product.Id.ToString();
                panel.labelCat.Text = product.Nom;
                // panel.lblPrix.Text = product.Price.ToString() + "dt";
                // panel.pictureBox1.Image = Image.FromFile(product.Image);
                // panel.pictureBox1.Click += new EventHandler((s, e) => ImgProduct_Click(s, e, Int32.Parse(panel.lblId.Text)));

                panel.Location = new Point(newX, newY);

                this.panel5.Controls.Add(panel);
                i++;
                newX += 310;

                if (i % 3 == 0)
                {
                    newY += 70;
                    newX  = initialX;
                }
            }
        }
        public async Task Test_GetAllCategories_Retourne_5_Categories()
        {
            var categories = await _categorieService.GetAllCategories();

            Assert.Equal(5, categories.ToList().Count);
        }