public void ValidMethodOK() { //create an instace of the class clsProducts AProduct = new clsProducts(); //string variable to store error message String Error = ""; //invoke the method Error = AProduct.Valid(ProductID, ProductName, Price, Quantity); //test if result is correct Assert.AreEqual(Error, ""); }
public void QuantityMid() { //create an instace of the class clsProducts AProduct = new clsProducts(); //string variable to store error string Error = ""; //create test data to pass to the method string Quantity = "111"; //this will pass //invoke the method Error = AProduct.Valid(ProductID, ProductName, Price, Quantity); //test if result is correct Assert.AreEqual(Error, ""); }
public void ProductIDMinMinusOne() { //create an instace of the class clsProducts AProduct = new clsProducts(); //string variable to store error message String Error = ""; //create test data to pass to method string ProductID = ""; //this will trigger error //invoke the method Error = AProduct.Valid(ProductID, ProductName, Price, Quantity); //test if result is correct Assert.AreNotEqual(Error, ""); }
public void QuantityExtremeMax() { //create an instace of the class clsProducts AProduct = new clsProducts(); //string variable to store error string Error = ""; //create test data to pass to the method string Quantity = ""; //this will fail Quantity = Quantity.PadRight(500, '1'); //invoke the method Error = AProduct.Valid(ProductID, ProductName, Price, Quantity); //test if result is correct Assert.AreNotEqual(Error, ""); }
public void ProductNameMaxMinusOne() { //create an instace of the class clsProducts AProduct = new clsProducts(); //string variable to store error string Error = ""; //create test data to pass to the method string ProductName = ""; //this will pass ProductName = ProductName.PadRight(19, 'a'); //invoke the method Error = AProduct.Valid(ProductID, ProductName, Price, Quantity); //test if result is correct Assert.AreEqual(Error, ""); }