Depending on length of fuel line between carb and shutoff these engines can run 5-10 minutes with the shutoff closed. Especially if its just running with no load on it. Engine rpm is a factor as well. If you close the choke when it starts to stumble you can often squeeze another 30 seconds of run time from it.
You can get a pair of plastic locking pliers that are made to pinch a rubber fuel line closed as well if you suspect the shutoff valve is not working. I have a few pair of them for applications that dont have shutoffs. Harbor freight used to have them, maybe they still do. But I am sure they can be found from other tool suppliers.