public void ValidObjectId() { var connection = TestConfiguration.GetConnection(); var context = new MongoDbContext(connection); var entity = new MongoDbUtilityModel(); context.ChangeTracker.SetEntityState(entity, EntityEntryState.Added); context.SaveChanges(); Assert.IsTrue(MongoDbUtility.IsValidObjectId(entity.Id)); }
public void ValidObjectId() { var database = TestConfiguration.GetDatabase(); var entityContainer = new DbEntityCollection <MongoDbUtilityModel>(); var writer = new DbEntityWriter <MongoDbUtilityModel>(database); var entity = new MongoDbUtilityModel(); entityContainer.Update(entity, DbEntityEntryState.Added); writer.Write(entityContainer); Assert.IsTrue(MongoDbUtility.IsValidObjectId(entity.Id)); }
public void ValidObjectId() { var connection = TestConfiguration.GetConnection(); var writerPipeline = new EntityWriterPipeline <MongoDbUtilityModel>(connection); var entityCollection = new EntityCollection <MongoDbUtilityModel>(); writerPipeline.AddCollection(entityCollection); var entity = new MongoDbUtilityModel(); entityCollection.Update(entity, EntityEntryState.Added); writerPipeline.Write(); Assert.IsTrue(MongoDbUtility.IsValidObjectId(entity.Id)); }