/// <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); }
private void AssertStoredType(IStoredClass clazz, string fieldName, Type type) { IStoredField field = clazz.StoredField(fieldName, null); Assert.AreEqual(type.FullName, CrossPlatformServices.SimpleName(field.GetStoredType ().GetName())); }
private static string RunJavaApplication() { return (JavaServices.java("NetArrayFromJava.Program", DataFile, CrossPlatformServices.FullyQualifiedName(typeof(Item)))); }
public void OnEvent(object sender, ClassEventArgs args) { var classEventArgs = args; Assert.AreEqual(typeof(Data).FullName, CrossPlatformServices .SimpleName(classEventArgs.ClassMetadata().GetName())); eventFlag.eventOccurred = true; }
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); }
/// <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); }
public void OnEvent(object sender, Db4objects.Db4o.Events.ClassEventArgs args) { ClassEventArgs classEventArgs = (ClassEventArgs)args; Assert.AreEqual(typeof(ClassRegistrationEventsTestCase.Data).FullName, CrossPlatformServices .SimpleName(classEventArgs.ClassMetadata().GetName())); eventFlag.eventOccurred = true; }
public AbstractFileBasedDb4oFixture() { var fileName = FileName(); _databaseFile = new File(CrossPlatformServices.DatabasePath(fileName)); }
private static string FilePath() { return(CrossPlatformServices.DatabasePath(File)); }
private string FullyQualifiedName(Type klass) { return(CrossPlatformServices.FullyQualifiedName(klass)); }
public AbstractFileBasedDb4oFixture() { string fileName = FileName(); _databaseFile = new Sharpen.IO.File(CrossPlatformServices.DatabasePath(fileName)); }