Invasion thresholds for fungicide resistance: deterministic and stochastic analyses