public virtual void CallbackMode(CallBackMode mode)
 {
     _config.CallbackMode(mode);
 }
Example #2
0
            public virtual void Test()
            {
                ICommonConfigurationProvider config = ((ICommonConfigurationProvider)Subject());
                Config4Impl          legacy         = Db4oLegacyConfigurationBridge.AsLegacy(config);
                ICommonConfiguration common         = config.Common;

                common.ActivationDepth = 42;
                Assert.AreEqual(42, legacy.ActivationDepth());
                Assert.AreEqual(42, common.ActivationDepth);
                // TODO: assert
                common.Add(new _IConfigurationItem_41());
                TypeAlias alias = new TypeAlias("foo", "bar");

                common.AddAlias(alias);
                Assert.AreEqual("bar", legacy.ResolveAliasStoredName("foo"));
                Assert.AreEqual("foo", legacy.ResolveAliasRuntimeName("bar"));
                common.RemoveAlias(alias);
                Assert.AreEqual("foo", legacy.ResolveAliasStoredName("foo"));
                common.AllowVersionUpdates = false;
                Assert.IsFalse(legacy.AllowVersionUpdates());
                common.AutomaticShutDown = false;
                Assert.IsFalse(legacy.AutomaticShutDown());
                common.BTreeNodeSize = 42;
                Assert.AreEqual(42, legacy.BTreeNodeSize());
                common.Callbacks = false;
                Assert.AreEqual(CallBackMode.None, legacy.CallbackMode());
                common.CallConstructors = false;
                Assert.IsTrue(legacy.CallConstructors().DefiniteNo());
                common.DetectSchemaChanges = false;
                Assert.IsFalse(legacy.DetectSchemaChanges());
                DiagnosticCollector collector = new DiagnosticCollector();

                common.Diagnostic.AddListener(collector);
                IDiagnostic diagnostic = DummyDiagnostic();

                legacy.DiagnosticProcessor().OnDiagnostic(diagnostic);
                collector.Verify(new object[] { diagnostic });
                common.ExceptionsOnNotStorable = true;
                Assert.IsTrue(legacy.ExceptionsOnNotStorable());
                common.InternStrings = true;
                Assert.IsTrue(legacy.InternStrings());
                // TODO: assert
                common.MarkTransient("Foo");
                common.MessageLevel = 3;
                Assert.AreEqual(3, legacy.MessageLevel());
                IObjectClass objectClass = common.ObjectClass(typeof(CommonAndLocalConfigurationTestSuite.BaseConfigurationProviderTestUnit.Item
                                                                     ));

                objectClass.CascadeOnDelete(true);
                Assert.IsTrue(((Config4Class)legacy.ObjectClass(typeof(CommonAndLocalConfigurationTestSuite.BaseConfigurationProviderTestUnit.Item
                                                                       ))).CascadeOnDelete().DefiniteYes());
                Assert.IsTrue(((Config4Class)common.ObjectClass(typeof(CommonAndLocalConfigurationTestSuite.BaseConfigurationProviderTestUnit.Item
                                                                       ))).CascadeOnDelete().DefiniteYes());
                common.OptimizeNativeQueries = false;
                Assert.IsFalse(legacy.OptimizeNativeQueries());
                Assert.IsFalse(common.OptimizeNativeQueries);
                common.Queries.EvaluationMode(QueryEvaluationMode.Lazy);
                Assert.AreEqual(QueryEvaluationMode.Lazy, legacy.EvaluationMode());
                // TODO: test reflectWith()
                // TODO: this probably won't sharpen :/
                TextWriter outStream = Sharpen.Runtime.Out;

                common.OutStream = outStream;
                Assert.AreEqual(outStream, legacy.OutStream());
                IStringEncoding stringEncoding = new _IStringEncoding_113();

                common.StringEncoding = stringEncoding;
                Assert.AreEqual(stringEncoding, legacy.StringEncoding());
                common.TestConstructors = false;
                Assert.IsFalse(legacy.TestConstructors());
                common.TestConstructors = true;
                Assert.IsTrue(legacy.TestConstructors());
                common.UpdateDepth = 1024;
                Assert.AreEqual(1024, legacy.UpdateDepth());
                common.WeakReferences = false;
                Assert.IsFalse(legacy.WeakReferences());
                common.WeakReferenceCollectionInterval = 1024;
                Assert.AreEqual(1024, legacy.WeakReferenceCollectionInterval());
            }