public void TestProductNoFound() { //create an instance of the class we want to create clsProduct AProduct = new clsProduct(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is OK (assume it is) Boolean OK = true; //create some test data to use with the method Int32 ProductNo = 2; //invoke the method Found = AProduct.Find(ProductNo); //check the product no if (Convert.ToInt32(AProduct.ProductNo) != 2) { OK = false; } //test to see that result is correct Assert.IsTrue(OK); }
public void TestProductsInStockFound() { //create an instance of the class we want to create clsProduct AProduct = new clsProduct(); //Boolean variable to store the result of the validation Boolean Found = false; //boolean variable to record if data is OK (assume it is) Boolean OK = true; //create some test data to use with the method Int32 ProductNo = 1; //invoke the mothod Found = AProduct.Find(ProductNo); //chech the address no if (AProduct.ProductsInStock != 8) { OK = false; } //test to see if the result is correct Assert.IsTrue(OK); }
public void FindMethodOK() { //create an instance of the class we want to create clsProduct AProduct = new clsProduct(); //boolean variable to store the result of the validation Boolean Found = false; //create some test data to use with the method Int32 ProductNo = 2; //invoke the method Found = AProduct.Find(ProductNo); //test to see that the result is correct Assert.IsTrue(Found); }