Can eating chocolate just before a blood test affect the result for my blood sugar levels?

Definitely. Eating anything will cause your blood sugar to go up on a blood test.
Yes. Yes, because the sugar in the chocolate will be absorbed and increase the amount of sugar in your blood, so the value will be higher. Let your physician know and they can interpret it in that context (as a post-prandial value). Still, if you are not a diabetic, the blood sugar should be < 140 mg/dl even if you ate candy or chocolate.