People keep asking me how to do mock in PowerUnit, here is my solution.
Unfortunately, PowerBuilder doesn’t have interface concept yet. We have to use class inheritance to work around.
Also, constructor parameter is another missing must-have for mocking. A customized of_init(parms) function is needed to simulate this.
source code of nvo_developer:// instance variables nvo_drink iDrink //constructor nvo_drink drink drink = create nvo_drink of_init(drink) //public subroutine of_init (readonly nvo_drink adrink); iDrink = aDrink //public function string of_work (); if ( not isValid(iDrink) ) then return "No drink, no work." return iDrink.NameAdvertisements