MongoDB.Driver.TestCollectionSafeMode.TestBadInsert C# (CSharp) Метод

TestBadInsert() приватный Метод

private TestBadInsert ( ) : void
Результат void
        public void TestBadInsert()
        {
            IMongoCollection col = InitCollection("safeinsert");
            bool thrown = false;
            try{
                col.Insert(new Document(){{"x",1},{"y",2}},true);
            }catch(MongoDuplicateKeyException mdk){
                thrown = true;
            }catch(Exception e){
                Assert.Fail(String.Format("Wrong exception thrown: {0}", e.GetType().Name));
            }
            Assert.IsTrue(thrown);
        }