public void TestBadUpdate()
{
IMongoCollection col = InitCollection("safeupdate");
bool thrown = false;
try{
col.Update(new Document(){{"x", 1}}, new Document(){{"x",2}},true);
}catch(MongoDuplicateKeyUpdateException){
thrown = true;
}catch(MongoDuplicateKeyException mdk){
Assert.Fail("MongoDuplicateKeyException thown instead of MongoDuplicateKeyUpdateException");
}catch(Exception e){
Assert.Fail(String.Format("Wrong exception thrown: {0}", e.GetType().Name));
}
Assert.IsTrue(thrown);
}