Esempio n. 1
0
            /// <exception cref="System.Exception"></exception>
            public virtual void Test()
            {
                if (CommonAndLocalConfigurationTestSuite.Subject() is IClientConfiguration)
                {
                    return;
                }
                IFileConfigurationProvider config     = ((IFileConfigurationProvider)Subject());
                IFileConfiguration         fileConfig = config.File;
                Config4Impl legacyConfig = Db4oLegacyConfigurationBridge.AsLegacy(config);

                fileConfig.BlockSize = 42;
                Assert.AreEqual(42, legacyConfig.BlockSize());
                fileConfig.DatabaseGrowthSize = 42;
                Assert.AreEqual(42, legacyConfig.DatabaseGrowthSize());
                fileConfig.DisableCommitRecovery();
                Assert.IsTrue(legacyConfig.CommitRecoveryDisabled());
                fileConfig.Freespace.DiscardSmallerThan(8);
                Assert.AreEqual(8, legacyConfig.DiscardFreeSpace());
                fileConfig.GenerateUUIDs = ConfigScope.Globally;
                Assert.AreEqual(ConfigScope.Globally, legacyConfig.GenerateUUIDs());
                fileConfig.GenerateCommitTimestamps = true;
                Assert.IsTrue(legacyConfig.GenerateCommitTimestamps().DefiniteYes());
                IStorage storageFactory = new FileStorage();

                fileConfig.Storage = storageFactory;
                Assert.AreSame(storageFactory, legacyConfig.Storage);
                Assert.AreSame(storageFactory, fileConfig.Storage);
                fileConfig.LockDatabaseFile = true;
                Assert.IsTrue(legacyConfig.LockFile());
                fileConfig.ReserveStorageSpace = 1024;
                Assert.AreEqual(1024, legacyConfig.ReservedStorageSpace());
                fileConfig.BlobPath = Path.GetTempPath();
                Assert.AreEqual(Path.GetTempPath(), legacyConfig.BlobPath());
                fileConfig.ReadOnly = true;
                Assert.IsTrue(legacyConfig.IsReadOnly());
                ICacheConfigurationProvider cacheProvider = ((ICacheConfigurationProvider)Subject
                                                                 ());
                ICacheConfiguration            cache = cacheProvider.Cache;
                IIdSystemConfigurationProvider idSystemConfigurationProvider = ((IIdSystemConfigurationProvider
                                                                                 )Subject());
                IIdSystemConfiguration idSystemConfiguration = idSystemConfigurationProvider.IdSystem;

                Assert.AreEqual(StandardIdSystemFactory.Default, legacyConfig.IdSystemType());
                idSystemConfiguration.UseStackedBTreeSystem();
                Assert.AreEqual(StandardIdSystemFactory.StackedBtree, legacyConfig.IdSystemType()
                                );
                idSystemConfiguration.UsePointerBasedSystem();
                Assert.AreEqual(StandardIdSystemFactory.PointerBased, legacyConfig.IdSystemType()
                                );
            }