public void verify_save_with_empty_object_id_throws() { MongoDriverHelperTestsClassWithObjectId obj = new MongoDriverHelperTestsClassWithObjectId() { Name = "A" }; _collectionObjectId.Save(obj, obj.Id); }
public void verify_save_with_empty_object_id_throws() { MongoDriverHelperTestsClassWithObjectId obj = new MongoDriverHelperTestsClassWithObjectId() { Name = "A" }; Assert.That(() => _collectionObjectId.Save(obj, obj.Id), Throws.Exception.With.Message.Contains("Cannot save with null objectId")); }
public void verify_object_id_is_generated() { MongoDriverHelperTestsClassWithObjectId obj = new MongoDriverHelperTestsClassWithObjectId() { Name = "A" }; _collectionObjectId.SaveWithGeneratedObjectId(obj, id => obj.Id = id); Assert.That(obj.Id, Is.Not.EqualTo(ObjectId.Empty)); var saved = _collectionObjectId.FindOneById(obj.Id); Assert.That(saved.Name, Is.EqualTo("A")); }