Must admit, Sarnie's got a point.
I'd never admit to a salesman that I wasn't going to buy a car from him, as that's just going to put him off straight away and probably with good cause. I do think the salesman could've handled it better, however we don't know if the OP marched in with an attitude or not so that could've been the reason for the hostility. Not saying that is what happened, but if you feel you're being fobbed off you're likely to get the hump which makes you even more defensive, and that then annoys the other guy further etc.
It's all about the attitude. If you're polite, pleasant, make the right noises without committing to anything then you'll always get your test drive.