Is there any way to write a unit test that checks reference counts?