I created this array of objects:
$ad_1 = new AdUnit(array(\'id\' => \'1\', \'name\' => \'Ad_1\', \'description\' => \'great ad\', \'code\' => \'alpha
Try the assertContains method:
$this->assertContains( $randad, $adUnitArr );