public void TestMultiUpdate()
{
IMongoCollection col = InitCollection("safemupdate");
Document newy = new Document(){{"y", 2}};
col.UpdateAll(newy, new Document(){{"y",1}},true);
Assert.AreEqual(5, col.Count(newy));
bool thrown = false;
try{
col.UpdateAll(new Document(){{"x",1}}, new Document(){{"y",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, "Exception not thrown.");
}