public function testReadWithConditions()
{
$this->_db->connect();
$connection = $this->_db->connection;
$this->_db->connection = new MockMongoSource();
$this->_db->connection->resultSets = array(array('ok' => true));
$data = array('title' => 'Test Post');
$options = array('w' => 1, 'wTimeoutMS' => 10000, 'fsync' => false);
$this->_query->data($data);
$this->assertTrue($this->_db->create($this->_query));
$this->_query->data(null);
$this->_db->connection->resultSets = array(array());
$this->_query->conditions(array('title' => 'Nonexistent Post'));
$result = $this->_db->read($this->_query);
$this->assertNotEmpty($result);
$this->assertEqual(0, $result->count());
$this->_db->connection->resultSets = array(array($data));
$this->_query->conditions($data);
$result = $this->_db->read($this->_query);
$this->assertNotEmpty($result);
$this->assertEqual(1, $result->count());
$this->_db->connection = $connection;
}