public void AddProductCtrFailPrice() { var productCtr = new ProductCtr(new ProductCtrTestClass()); var product = new Product("The product name", -1m, "The product description", "", "Img path"); var flag = productCtr.AddProduct(product); Assert.AreEqual(0, flag); }
public void AddProductCtrFailDescription2() { var productCtr = new ProductCtr(new ProductCtrTestClass()); var product = new Product("The product name", 23.45m, "", "The product catagory", "Img path"); var flag = productCtr.AddProduct(product); Assert.AreEqual(0, flag); }
public void AddProductCtrFailCategory() { var productCtr = new ProductCtr(new ProductCtrTestClass()); var product = new Product("The product name", 23.45m, "The product description", null, "Img path"); var flag = productCtr.AddProduct(product); Assert.AreEqual(0, flag); }
public void DeleteProductCtr() { var productCtr = new ProductCtr(new ProductCtrTestClass()); var product = new Product("The product1 name", 23.45m, "The product1 description", "The product1 catagory", "Img path"); var flag = productCtr.AddProduct(product); flag = productCtr.DeleteProduct(flag); Assert.AreEqual(1, flag); }
public void GetProductCtr() { var productCtr = new ProductCtr(new ProductCtrTestClass()); var product = new Product("The product name", 23.45m, "The product description", "The product catagory", "Img path"); productCtr.AddProduct(product); var flag = productCtr.GetProduct(1); Assert.IsNotNull(flag); }
public void UpdateProductCtr() { var productCtr = new ProductCtr(new ProductCtrTestClass()); var product = new Product(1, "The product name", 23.45m, "The product description", "The product catagory", "Img path"); productCtr.AddProduct(product); product = new Product(1, "The product new name", 34.56m, "The product new description", "The product new catagory", "Img path"); var flag = productCtr.UpdateProduct(product); Assert.AreEqual(1, flag); }
///// <summary> ///// Delete a Chain ///// </summary> ///// <param name="id"></param> ///// <returns> ///// Return 1 if Chain was deleted, else 0 ///// </returns> //public int DeleteChain(int id) //{ // return ChainCtr.DeleteChain(id); //} /// <summary> /// Add a Product /// </summary> /// <param name="product"></param> /// <returns> /// Id of Product if added, else 0 /// </returns> public int AddProduct(Product product) { return(ProductCtr.AddProduct(product)); }