Fixed a unit test that was failing under mono.

Test was failing because of a missing lock() statement to avoid race conditions.