I'd like to test my software with some amount of packet loss. I see that I can do this with pfSense in the traffic shaping. But that's a lot of hassle to set up and create a couple of extra virtual switches and so on.
Can I do this directly in ESX to a particular network interface or across an entire virtual switch?
No. You'll need to route the traffic through a linux or BSD box to mangle the packets.
As EEAA stated, nothing you can do specifically in ESX(i) to acomplish this, however...
There a fairly simple free tool called "WANEM" http://packetlife.net/blog/2011/jan/12/emulating-wans-wanem/
Basically you boot from the iso, setup an IP, configured your default route (client side) to the wanem IP, set your tcp parameter and away you go.