Пример #1
0
        public void DeleteProductTestMethod()
        {
            bool resAdd = ProductDbController.AddProduct("Potato", "gr");

            Assert.IsTrue(resAdd);
            List <Product> list   = ProductDbController.GetProducts();
            int            count  = list.Count;
            bool           resDel = ProductDbController.DeleteProduct(list[count - 1].Id);

            Assert.IsTrue(resDel);
            Assert.AreEqual(ProductDbController.GetProducts().Count, --count);
        }
Пример #2
0
 private void AddButton_Click(object sender, EventArgs e)
 {
     if (textBoxName.Text != "" && textBoxUnit.Text != "")
     {
         ProductDbController.AddProduct(textBoxName.Text, textBoxUnit.Text);
         MessageBox.Show("Success");
     }
     else
     {
         MessageBox.Show("All fields must be filled! Please try again)");
     }
 }
Пример #3
0
        public void AddProductTestMethod()
        {
            List <Product> list  = ProductDbController.GetProducts();
            int            count = list.Count;
            bool           res   = ProductDbController.AddProduct("Potato", "gr");

            Assert.AreEqual(res, true);
            List <Product> resList = ProductDbController.GetProducts();

            Assert.AreEqual(resList.Count, ++count);
            Assert.AreEqual(resList[count - 1].Name, "Potato");
            Assert.AreEqual(resList[count - 1].Unit, "gr");
        }