Magnetohydrodynamic Evolution of H II Regions in Molecular Clouds: Simulation Methodology, Tests, and Uniform Media