//test that the StockItemDescription validation throws an error //when StockItemDescription is more than 8 characters public void StockItemDescriptionMaxPlusOne() { //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(101); //test the valid method with a two character string OK = AstockItem.StockCodeValid(SomeText); //assert that the outcome should be true Assert.IsFalse(OK); }
//used to test the presence of the valid method public void StockCodeMid() { //create and instance of the class clsStockItem AStockItem = new clsStockItem(); Boolean OK; //test to see if the valid method exists OK = AStockItem.StockCodeValid("4"); Assert.IsTrue(OK); }