//used to test the presence of the valid method public void StockNameValidOK() { //create and instance of the class clsStockItem AStockItem = new clsStockItem(); Boolean OK; //test to see if the valid method exists OK = AStockItem.StockNameValid("12111"); Assert.IsTrue(OK); }
//test that the StockName validation throws an error when //StockName is more than 8 characters public void StockNameMaxPlusOne() { //create and instance of the class clsStockItem AstockItem = new clsStockItem(); //create a varaible to record the result of the validation test Boolean OK; //create a variable to store the test data string SomeText = ""; //pad the data to the required number of characters SomeText = SomeText.PadLeft(26); //test the valid method with a two character string OK = AstockItem.StockNameValid(SomeText); //assert that the outcome should be true Assert.IsFalse(OK); }
//used to test the presence of the valid method public void StockNameMinLessOne() { //create and instance of the class clsStockItem AStockItem = new clsStockItem(); Boolean OK; //test to see if the valid method exists OK = AStockItem.StockNameValid("5555"); Assert.IsFalse(OK); }