Structure and thermodynamics of square-well and square-shoulder fluids