public void TestClassWithBsonObjectId() { _collection.RemoveAll(); var doc = new ClassWithBsonObjectId { Id = null, X = 1 }; _collection.Insert(doc); Assert.IsNotNull(doc.Id); Assert.AreNotEqual(ObjectId.Empty, doc.Id.AsObjectId); doc = new ClassWithBsonObjectId { Id = ObjectId.Empty, X = 1 }; _collection.Insert(doc); Assert.AreNotEqual(ObjectId.Empty, doc.Id.AsObjectId); doc = new ClassWithBsonObjectId { Id = ObjectId.GenerateNewId(), X = 1 }; _collection.Insert(doc); }
public void TestClassWithBsonObjectId() { _collection.RemoveAll(); var doc = new ClassWithBsonObjectId { Id = null, X = 1 }; _collection.Insert(doc); Assert.NotNull(doc.Id); Assert.NotEqual(ObjectId.Empty, doc.Id.AsObjectId); doc = new ClassWithBsonObjectId { Id = ObjectId.Empty, X = 1 }; _collection.Insert(doc); Assert.NotEqual(ObjectId.Empty, doc.Id.AsObjectId); doc = new ClassWithBsonObjectId { Id = ObjectId.GenerateNewId(), X = 1 }; _collection.Insert(doc); }