Ported some of the unittests to shared.