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