Ejemplo n.º 1
0
        /// <exception cref="System.Exception"></exception>
        public virtual void TestRemoveArrayField()
        {
            var dataA = new DataBefore
                            ("a", true, new object[] { "X" });
            var dataB = new DataBefore
                            ("b", false, new object[0]);

            Store(dataA);
            Store(dataB);
            var oc = Fixture().Config().ObjectClass(typeof(DataBefore
                                                           ));

            // we must use ReflectPlatform here as the string must include
            // the assembly name in .net
            oc.Rename(CrossPlatformServices.FullyQualifiedName(typeof(DataAfter
                                                                      )));
            Reopen();
            var query = NewQuery(typeof(DataAfter));

            query.Descend("name").Constrain("a");
            var result = query.Execute();

            Assert.AreEqual(1, result.Count);
            var data = (DataAfter)result
                       .Next();

            Assert.AreEqual(dataA.name, data.name);
            Assert.AreEqual(dataA.status, data.status);
        }
Ejemplo n.º 2
0
 private static string RunJavaApplication()
 {
     return
         (JavaServices.java("NetArrayFromJava.Program",
                            DataFile,
                            CrossPlatformServices.FullyQualifiedName(typeof(Item))));
 }
Ejemplo n.º 3
0
        private IEmbeddedConfiguration RenameConfig()
        {
            IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();

            configuration.Common.ObjectClass(typeof(RenamingClassAfterQueryingTestCase.A)).Rename
                (CrossPlatformServices.FullyQualifiedName(typeof(RenamingClassAfterQueryingTestCase.B
                                                                 )));
            return(configuration);
        }
        private IEmbeddedConfiguration AliasConfig()
        {
            IEmbeddedConfiguration configuration = Db4oEmbedded.NewConfiguration();

            configuration.Common.AddAlias(new TypeAlias(CrossPlatformServices.FullyQualifiedName
                                                            (typeof(AliasesQueryingTestCase.A)), CrossPlatformServices.FullyQualifiedName(typeof(
                                                                                                                                              AliasesQueryingTestCase.B))));
            return(configuration);
        }
        private IEmbeddedConfiguration RenameConfig()
        {
            var configuration = Db4oEmbedded.NewConfiguration();

            configuration.Common.ObjectClass(typeof(A)).Rename
                (CrossPlatformServices.FullyQualifiedName(typeof(B
                                                                 )));
            return(configuration);
        }
        public virtual void TestClassMetadataForName()
        {
            string className = CrossPlatformServices.FullyQualifiedName(typeof(InternalObjectContainerAPITestCase.Item
                                                                               ));
            ClassMetadata clazz = ((IInternalObjectContainer)Db()).ClassMetadataForName(className
                                                                                        );

            Assert.AreEqual(className, clazz.GetName());
            Assert.AreEqual(Reflector().ForClass(typeof(InternalObjectContainerAPITestCase.Item
                                                        )), clazz.ClassReflector());
        }
            public void OnDiagnostic(IDiagnostic diagnostic)
            {
                if (!(diagnostic is NotTransparentActivationEnabled))
                {
                    return;
                }
                var taDiagnostic = (NotTransparentActivationEnabled)diagnostic;

                Assert.AreEqual(CrossPlatformServices.FullyQualifiedName(typeof(NotTAAwareData
                                                                                )), ((ClassMetadata)taDiagnostic.Reason()).GetName());
                _enclosing._registered._registeredCount++;
            }
        /// <exception cref="System.Exception"></exception>
        private void AssertRenamed(bool doReopen)
        {
            var originalClazz = Db().Ext().StoredClass(typeof(Original
                                                              ));

            originalClazz.Rename(CrossPlatformServices.FullyQualifiedName(typeof(Changed
                                                                                 )));
            if (doReopen)
            {
                Reopen();
            }
            var changedObject = (Changed)RetrieveOnlyInstance(typeof(Changed
                                                                     ));

            Assert.AreEqual(Name, changedObject._name);
            Assert.IsNull(changedObject._otherName);
        }
Ejemplo n.º 9
0
        /// <exception cref="System.Exception"></exception>
        public virtual void Test()
        {
            Store(new Original("original"));
            Db().Commit();
            Assert.AreEqual(1, CountOccurences(typeof(Original)));
            // Rename messages are visible at level 1
            // fixture().config().messageLevel(1);
            var oc = Fixture().Config().ObjectClass(typeof(Original
                                                           ));

            // allways rename fields first
            oc.ObjectField("originalName").Rename("changedName");
            // we must use ReflectPlatform here as the string must include
            // the assembly name in .net
            oc.Rename(CrossPlatformServices.FullyQualifiedName(typeof(Changed
                                                                      )));
            Reopen();
            Assert.AreEqual(0, CountOccurences(typeof(Original)));
            Assert.AreEqual(1, CountOccurences(typeof(Changed)));
            var changed = (Changed)RetrieveOnlyInstance(typeof(Changed
                                                               ));

            Assert.AreEqual("original", changed.changedName);
        }
Ejemplo n.º 10
0
 private string FullyQualifiedName(Type klass)
 {
     return(CrossPlatformServices.FullyQualifiedName(klass));
 }