First off, the shotgun has a reduced range and is a bit more random. However, it can counter a sword lunge. To do this you need to shoot right when the sword lunge is about to hit you. Also it is a good idea to melee after a shooting the shotgun if the shotgun shell does not kill your opponent. The reason is that you can melee faster than you can shoot again.
Pair it with: Grenades, the battle rifle, the carbine, sniper rifles, melees, and plasma rifles.
Do not pair it with: the energy sword.