Pitch-angle scattering in magnetostatic turbulence. I. Test-particle simulations and the validity of analytical results