コード例 #1
0
        public static DefragmentConfig DefragConfig(string sourceFile, IEmbeddedConfiguration
                                                    db4oConfig, bool forceBackupDelete)
        {
            var defragConfig = new DefragmentConfig(sourceFile, DefragmentTestCaseBase
                                                    .BackupFileNameFor(sourceFile));

            defragConfig.ForceBackupDelete(forceBackupDelete);
            defragConfig.Db4oConfig(Db4oConfig(db4oConfig));
            return(defragConfig);
        }
コード例 #2
0
        /// <exception cref="System.IO.IOException"></exception>
        public static void AssertIndex(string fieldName, string databaseFileName, IClosure4
                                       configProvider)
        {
            ForceIndex(databaseFileName, ((IEmbeddedConfiguration)configProvider.Run()));
            var defragConfig = new DefragmentConfig(databaseFileName, DefragmentTestCaseBase
                                                    .BackupFileNameFor(databaseFileName));

            defragConfig.Db4oConfig(((IEmbeddedConfiguration)configProvider.Run()));
            Db4o.Defragment.Defragment.Defrag(defragConfig);
            IObjectContainer db = Db4oEmbedded.OpenFile(((IEmbeddedConfiguration)configProvider
                                                         .Run()), databaseFileName);
            var query = db.Query();

            query.Constrain(typeof(Data));
            query.Descend(fieldName).Constrain(Value);
            var result = query.Execute();

            Assert.AreEqual(1, result.Count);
            db.Close();
        }