public void OnViewLoadedSetsCategorieIntheView() { // Mock the View MockRepository mocks = new MockRepository(); //Arrange var service = mocks.DynamicMock<ICategorieService>(); //Act var controller = mocks.DynamicMock<ICategorieController>(); // Create Presenter With Mock View and Dummy BlogService CategorieService serviceActual = new MockCategorieService(); var controllerActual = new CategorieController(serviceActual,null,null); var presenter = new CategorieenPresenter(controllerActual); var cat = new BeheerContextEntity { DataKeyValue = "added" }; IList<BeheerContextEntity> list= new List<BeheerContextEntity>(); list.Add(cat); //controller.AddBusinessEntity(cat); // Set Expectations controller.Expect(action=>action.AddBusinessEntity(cat)); //presenter.Expect(action => action.OnViewLoaded()); // Tell Rhino Mocks We're Done Setting Expectations mocks.ReplayAll(); presenter.OnViewLoaded(); mocks.VerifyAll(); }
public CategorieControllerTest() { _categorie = new Categorie(); _listeCategories = new List <Categorie>(); _categories = GetCategories(); _mockCategorieServiceRepository = new Mock <ICategorieService>(); _mockCategorieServiceRepository.Setup(m => m.GetAllCategories()).Returns(_categories); _CategorieController = new CategorieController(_mockCategorieServiceRepository.Object); }
public UcCategorie(CategorieController controller) : this() { _controller = controller; ChargerGridView(); BindingSouce(); InitErrorProvider(); }
public CategorieControllerTest() { var options = new DbContextOptionsBuilder <BD_EPM>() .UseInMemoryDatabase("DatabaseTrace-" + $"{Guid.NewGuid()}") .Options; var bdEnMemoire = new BD_EPM(options); _CategorieController = new CategorieController(bdEnMemoire); }
private void Laptopbutton_Click(object sender, EventArgs e) { panel3.Visible = false; addProductLabel.Visible = false; myProductsPanel.Visible = true; dateFirma.Visible = false; VizualizareComenzi.Visible = false; Vanzatori vanzator = VanzatorController.GetSellerById(getUserID_Vanzatordb()); Button button = sender as Button; produses = CategorieController.getProduseBySeller(button.Text.ToString(), vanzator.VanzatorId); List <PictureBox> poze = new List <PictureBox> { pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7 }; List <Label> labels = new List <Label> { label5, label6, label7, label8, label9, label10 }; List <Button> buttons = new List <Button> { Laptopbutton, TableteButton, Pc_Periferice_button, haine_button, telefoaneBUtton, button6, carti_button, Auto_moto_button }; for (int i = 0; i < produses.Count; i++) { labels[i].Text = null; string numeProdus = produses[i].NumeProdus; string[] vs = numeProdus.Split(' '); for (int j = 0; j < vs.Length; j++) { labels[i].Text += vs[j] + " "; if (j % 3 == 0 && j != 0) { labels[i].Text += "\n"; } } if (i == 0) { } } /* * for (int i = produses.Count; i < 8; i++) * { * poze[i].Image = null; * labels[i].Text = null; * buttons[i].Hide(); * } */ }
private void button1_Click(object sender, EventArgs e) { panel2.Visible = true; panel4.Visible = false; panel5.Visible = false; Button button = sender as Button; produses = CategorieController.getProduse(button.Text.ToString()); List <PictureBox> pictures = new List <PictureBox> { pictureBox1, pictureBox2, pictureBox3, pictureBox4, pictureBox5, pictureBox6, pictureBox7, pictureBox8 }; List <Label> smallLabels = new List <Label> { label3, label4, label5, label6, label7, label8, label9, label10 }; List <Label> bigLabels = new List <Label> { label13, label14, label15, label16, label17, label18, label19, label20 }; List <Button> buttons = new List <Button> { button11, button12, button13, button14, button15, button16, button17, button18 }; Console.WriteLine(); for (int i = 0; i < produses.Count; i++) { smallLabels[i].Text = null; string produ = produses[i].NumeProdus; string[] vs = produ.Split(' '); for (int j = 0; j < vs.Length; j++) { smallLabels[i].Text += vs[j] + " "; if (j % 3 == 0 && j != 0) { smallLabels[i].Text += "\n"; } } bigLabels[i].Text = produses[i].Pret.ToString() + " Lei"; if (i == 0) { //BitmapImage //pictures[0].Image = Bitmap.FromFile(Convert.ToBase64String(produses[0].Imagine)); //byte[] b = produses[73].Imagine; // var ms = new MemoryStream(produses[0].Imagine); //Console.WriteLine(b+" "+produses[0].NumeProdus); //Image img = Image.FromStream(ms); //pictureBox1.Image = img; //pictureBox1.Image = Image.FromStream(ms); // pictures[0].Image = Image.FromStream(produses[0].Imagine); // pictures[0].Image = (Bitmap)((new ImageConverter()).ConvertFrom(produses[0].Imagine)); //pictureBox1.Image = Image.FromStream(new MemoryStream((byte[])produses[0].Imagine)); // Image imagine = byteArrayToImage(b); } } for (int i = produses.Count; i < 8; i++) { pictures[i].Image = null; smallLabels[i].Text = null; bigLabels[i].Text = null; buttons[i].Hide(); } }