When I did my "Coastal Skipper" test years ago, it was a part of the test that as we were leaving the marina, still amongst the slips and piers, the examiner put the engine in neutral and asked "What are you going to do now?" Putting the engine back into gear was an option but then you failed the test.
Here's what I learned. Never use the main, always the headsail. Why? Because if the wind is from the back you have no way of depowering the boat and your chances are good of a crash gybe while you're trying to avoid obstacles. If the wind is from the front you will generate little headway with just a main.
With a jib out you can let the sail fly no matter where the wind is from and you can also point the boat into more directions and get headway than with a main.
I agree with another earlier post: Practise this when you're in control, with the engine idling at the ready if you get it wrong. That way you can soon determine your and your boats limitations under conditions that will not raise a sweat or an invoice for someone else's boat repairs.
Here's another problem to which I reckon there is no solution: Heading into a slip, you put the boat into reverse to slow and the boat accelerates forward
. What happened? The gear cable jumped out of it's little retainer and left the gearbox in forward. The more I tried to slow, the faster we went. We hit the main walkway at about 5 knots!!!
Maybe this should be a new thread?