/// <exception cref="System.Exception"></exception>
        public virtual void Test()
        {
            Db4oLibraryEnvironment originalEnv = EnvironmentForVersion("6.0");

            originalEnv.InvokeInstanceMethod(typeof(MigrationHopsTestCase.Tester), "createDatabase"
                                             , new object[] { TempFile() });
            string[] hopArray = new string[] { "6.4", "7.4", CurrentVersion() };
            for (int hopIndex = 0; hopIndex < hopArray.Length; ++hopIndex)
            {
                string hop = hopArray[hopIndex];
                Db4oLibraryEnvironment hopEnvironment = EnvironmentForVersion(hop);
                Assert.AreEqual(originalEnv.Version(), InvokeTesterMethodOn(hopEnvironment, "currentVersion"
                                                                            ));
            }
            IEmbeddedConfiguration config = Db4oEmbedded.NewConfiguration();

            config.Common.ReflectWith(new ExcludingReflector(new Type[] { typeof(MigrationHopsTestCase.Item
                                                                                 ) }));
            IEmbeddedObjectContainer container = Db4oEmbedded.OpenFile(config, TempFile());

            try
            {
                IQuery query = container.Query();
                query.Constrain(typeof(MigrationHopsTestCase.Item));
                object item = query.Execute()[0];
                Assert.AreEqual(originalEnv.Version(), ((GenericObject)item).Get(0));
            }
            finally
            {
                container.Close();
            }
        }
示例#2
0
        /// <exception cref="System.IO.IOException"></exception>
        private Db4oLibraryEnvironment NewEnvironment(string path)
        {
            Db4oLibraryEnvironment env = new Db4oLibraryEnvironment(new Sharpen.IO.File(path)
                                                                    , _classPath);

            _environments[path] = env;
            return(env);
        }
        /// <exception cref="System.IO.IOException"></exception>
        private Db4oLibraryEnvironment NewEnvironment(string path)
        {
            var env = new Db4oLibraryEnvironment(new File(path)
                                                 , _classPath);

            _environments[path] = env;
            return(env);
        }
示例#4
0
 public virtual void DisposeAll()
 {
     for (IEnumerator eIter = _environments.Values.GetEnumerator(); eIter.MoveNext();)
     {
         Db4oLibraryEnvironment e = ((Db4oLibraryEnvironment)eIter.Current);
         e.Dispose();
     }
     _environments.Clear();
 }
示例#5
0
        /// <exception cref="System.IO.IOException"></exception>
        public virtual Db4oLibraryEnvironment EnvironmentFor(string path)
        {
            Db4oLibraryEnvironment existing = ExistingEnvironment(path);

            if (existing != null)
            {
                return(existing);
            }
            return(NewEnvironment(path));
        }
 /// <exception cref="System.Exception"></exception>
 private object InvokeTesterMethodOn(Db4oLibraryEnvironment env74, string methodName
                                     )
 {
     return(env74.InvokeInstanceMethod(typeof(MigrationHopsTestCase.Tester), methodName
                                       , new object[] { TempFile() }));
 }
示例#7
0
 public Db4oLibrary(string path, Db4oLibraryEnvironment environment)
 {
     this.path        = path;
     this.environment = environment;
 }
示例#8
0
 /// <exception cref="System.Exception"></exception>
 private object InvokeTesterMethodOn(Db4oLibraryEnvironment env74, string methodName
                                     )
 {
     return(env74.InvokeInstanceMethod(typeof(Tester), methodName, TempFile()));
 }