We perform coarse-grained computer simulations of solutions of semidilute wormlike micelles and study their dynamic and rheological properties, both in equilibrium and under shear flow. The simulation model is tailored to the study of relatively large time and length scales (micrometers and several milliseconds), while it still retains the specific mechanical properties of the individual wormlike micelles. The majority of the mechanical properties (persistence length, diameter, and elastic modulus of a single worm) is determined from more detailed atomistic molecular dynamics simulations, providing the link with the chemistry of the surfactants. The method is applied to the case of a solution containing 8% (by weight) erucyl bis(hydroxymethyl)methylammonium chloride (EHAC). Different scission energies ranging from 15.5kbT to 19.1kBT are studied, leading to both unentangled and entangled wormlike micelles. We find a decrease in the average contour length and an increase in the average breaking rate with increasing shear rate. In equilibrium, the decay of the shear relaxation modulus of the unentangled samples agrees with predictions based on a theory of breakable Rouse chains. Under shear flow, transient over- and undershoots are measured in the stress tensor components. At high shear rates we observe a steady-state shear stress proportional to 1/3, where is the shear rate. This is confirmed by our high shear rate experiments of real EHAC in a parallel-plate geometry.