Beispiel #1
0
 private void buttonRefresh_Click(object sender, EventArgs e)
 {
     if (x == 1)
     {
         dataGridView.DataSource = DishesDbController.GetDishes();
         dataGridView.Refresh();
     }
     if (x == 2)
     {
         dataGridView.DataSource = RecipeDbController.GetRecipes();
         dataGridView.Refresh();
     }
     if (x == 3)
     {
         dataGridView.DataSource = PurchaseDbController.GetPurchases();
         dataGridView.Refresh();
     }
     if (x == 4)
     {
         dataGridView.DataSource = SaleDbController.GetSales();
         dataGridView.Refresh();
     }
     if (x == 5)
     {
         dataGridView.DataSource = ProductDbController.GetProducts();
         dataGridView.Refresh();
     }
     if (x == 6)
     {
         dataGridView.DataSource = LayoutDbController.GetLayouts();
         dataGridView.Refresh();
     }
 }
        public void DeletePurchaseTestMethod()
        {
            bool resAdd = PurchaseDbController.AddPurchase(11, 15.5, 5, "kg");

            Assert.IsTrue(resAdd);
            List <Purchase> list   = PurchaseDbController.GetPurchases();
            int             count  = list.Count;
            bool            resDel = PurchaseDbController.DeletePurchase(list[count - 1].Id);

            Assert.IsTrue(resDel);
            Assert.AreEqual(PurchaseDbController.GetPurchases().Count, --count);
        }
        public void AddPurchaseTestMethod()
        {
            List <Purchase> list  = PurchaseDbController.GetPurchases();
            int             count = list.Count;
            bool            res   = PurchaseDbController.AddPurchase(11, 15.5, 5, "kg");

            Assert.IsTrue(res);
            Assert.AreEqual(PurchaseDbController.GetPurchases().Count, ++count);
            List <Purchase> resList = PurchaseDbController.GetPurchases();

            Assert.AreEqual(resList[count - 1].IdProduct, 11);
            Assert.AreEqual(resList[count - 1].Quantity, 15.5);
            Assert.AreEqual(resList[count - 1].Price, 5);
            Assert.AreEqual(resList[count - 1].Unit, "kg");
        }
Beispiel #4
0
 private void purchasesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     labelTittle.Text        = "Table Purchases";
     dataGridView.DataSource = PurchaseDbController.GetPurchases();
     x = 3;
 }
        public void SelectPurchasesTestMethod()
        {
            List <Purchase> list = PurchaseDbController.GetPurchases();

            Assert.IsTrue(list != null);
        }