public void TestValueTypeAndEmbeddedType() { var pm = PmFactory.NewPersistenceManager(); Class cl = pm.NDOMapping.FindClass("DataTypeTestClasses.VtAndEtContainer"); Field f = cl.FindField("embeddedType.doubleVar"); f.Column.Size = 12; f.Column.Precision = 7; VtAndEtContainer cont = new VtAndEtContainer(); cont.Init(); pm.MakePersistent(cont); pm.Save(); pm.UnloadCache(); IList l = pm.GetClassExtent(typeof(VtAndEtContainer)); Assert.AreEqual(1, l.Count, "Anzahl Container stimmt nicht"); cont = (VtAndEtContainer)l[0]; AssertVtAndEtContainer(cont); }
void AssertVtAndEtContainer(VtAndEtContainer cont) { Assert.AreEqual(0x55, cont.PropValType.ByteVar, "ByteVar falsch #1"); Assert.AreEqual(true, cont.PropValType.BoolVar, "BoolVar falsch #1"); Assert.AreEqual(12.34m, cont.PropValType.DecVar, "DecVar falsch #1"); #if !FIREBIRD && !POSTGRE Assert.AreEqual(new DateTime(2002, 12, 1, 1, 0, 20), cont.PropValType.DateTimeVar, "DateTimeVar falsch #1"); #else Assert.AreEqual(new DateTime(2002, 12, 1, 0, 0, 0), cont.PropValType.DateTimeVar, "DateTimeVar falsch #1"); #endif #if SQLITE Assert.That(CheckDouble(12345.123456, cont.PropValType.DoubleVar), "DoubleVar falsch #1"); Assert.That(CheckFloat(12345.1f, cont.PropValType.FloatVar), "FloatVar falsch #1"); #else Assert.AreEqual(12345.123456, cont.PropValType.DoubleVar, "DoubleVar falsch #1"); Assert.AreEqual(12345.1f, cont.PropValType.FloatVar, "FloatVar falsch #1"); #endif Assert.AreEqual(new Guid("12341234-1234-1234-1234-123412341234"), cont.PropValType.GuidVar, "GuidVar falsch #1"); Assert.AreEqual(0x1234, cont.PropValType.Int16Var, "Int16Var falsch #1"); Assert.AreEqual(0x12341234, cont.PropValType.Int32Var, "Int32Var falsch #1"); Assert.AreEqual(0x143214321, cont.PropValType.Int64Var, "Int64Var falsch #1"); Assert.AreEqual("Teststring", cont.PropValType.StringVar, "StringVar falsch #1"); Assert.AreEqual(0xabc, cont.PropValType.Uint16Var, "Uint16Var falsch #1"); Assert.AreEqual(0x12341234, cont.PropValType.Uint32Var, "Uint32Var falsch #1"); Assert.AreEqual(0x143214321, cont.PropValType.Uint64Var, "Uint64Var falsch #1"); Assert.AreEqual(EnumType.zwei, cont.PropValType.EnumVar, "EnumVar falsch #1"); Assert.AreEqual(Guid.Empty, cont.PropValType.EmptyGuidVar, "EmptyGuidVar falsch #1"); Assert.AreEqual(DateTime.MinValue, cont.PropValType.EmptyDateTimeVar, "EmptyDateTimeVar falsch #1"); Assert.Null(cont.PropValType.NullString, "Empty String falsch #1"); Assert.AreEqual(0x55, cont.PubValType.ByteVar, "ByteVar falsch #2"); Assert.AreEqual(true, cont.PubValType.BoolVar, "BoolVar falsch #2"); Assert.AreEqual(12.34m, cont.PubValType.DecVar, "DecVar falsch #2"); #if !FIREBIRD && !POSTGRE Assert.AreEqual(new DateTime(2002, 12, 1, 1, 0, 20), cont.PubValType.DateTimeVar, "DateTimeVar falsch #2"); #else Assert.AreEqual(new DateTime(2002, 12, 1, 0, 0, 0), cont.PubValType.DateTimeVar, "DateTimeVar falsch #2"); #endif #if SQLITE Assert.That(CheckDouble(12345.123456, cont.PropValType.DoubleVar), "DoubleVar falsch #1"); Assert.That(CheckFloat(12345.1f, cont.PropValType.FloatVar), "FloatVar falsch #1"); #else Assert.AreEqual(12345.123456, cont.PubValType.DoubleVar, "DoubleVar falsch #2"); Assert.AreEqual(12345.1f, cont.PubValType.FloatVar, "FloatVar falsch #2"); #endif Assert.AreEqual(new Guid("12341234-1234-1234-1234-123412341234"), cont.PubValType.GuidVar, "GuidVar falsch #2"); Assert.AreEqual(0x1234, cont.PubValType.Int16Var, "Int16Var falsch #2"); Assert.AreEqual(0x12341234, cont.PubValType.Int32Var, "Int32Var falsch #2"); Assert.AreEqual(0x143214321, cont.PubValType.Int64Var, "Int64Var falsch #2"); Assert.AreEqual("Teststring", cont.PubValType.StringVar, "StringVar falsch #2"); Assert.AreEqual(0xabc, cont.PubValType.Uint16Var, "Uint16Var falsch #2"); Assert.AreEqual(0x12341234, cont.PubValType.Uint32Var, "Uint32Var falsch #2"); Assert.AreEqual(0x143214321, cont.PubValType.Uint64Var, "Uint64Var falsch #2"); Assert.AreEqual(EnumType.zwei, cont.PubValType.EnumVar, "EnumVar falsch #2"); Assert.AreEqual(Guid.Empty, cont.PubValType.EmptyGuidVar, "EmptyGuidVar falsch #2"); Assert.AreEqual(DateTime.MinValue, cont.PubValType.EmptyDateTimeVar, "EmptyDateTimeVar falsch #2"); Assert.Null(cont.PubValType.NullString, "Empty String falsch #1"); Assert.AreEqual(0x55, cont.EmbeddedType.ByteVar, "ByteVar falsch #3"); Assert.AreEqual(true, cont.EmbeddedType.BoolVar, "BoolVar falsch #3"); Assert.AreEqual(12.34m, cont.EmbeddedType.DecVar, "DecVar falsch #3"); #if !FIREBIRD && !POSTGRE Assert.AreEqual(new DateTime(2002, 12, 1, 1, 0, 20), cont.EmbeddedType.DateTimeVar, "DateTimeVar falsch #2"); #else Assert.AreEqual(new DateTime(2002, 12, 1, 0, 0, 0), cont.EmbeddedType.DateTimeVar, "DateTimeVar falsch #2"); #endif #if SQLITE Assert.That(CheckDouble(12345.123456, cont.PropValType.DoubleVar), "DoubleVar falsch #1"); Assert.That(CheckFloat(12345.1f, cont.PropValType.FloatVar), "FloatVar falsch #1"); #else Assert.AreEqual(12345.123456, cont.EmbeddedType.DoubleVar, "DoubleVar falsch #3"); Assert.AreEqual(12345.1f, cont.EmbeddedType.FloatVar, "FloatVar falsch #3"); #endif Assert.AreEqual(new Guid("12341234-1234-1234-1234-123412341234"), cont.EmbeddedType.GuidVar, "GuidVar falsch #3"); Assert.AreEqual(0x1234, cont.EmbeddedType.Int16Var, "Int16Var falsch #3"); Assert.AreEqual(0x12341234, cont.EmbeddedType.Int32Var, "Int32Var falsch #3"); Assert.AreEqual(0x143214321, cont.EmbeddedType.Int64Var, "Int64Var falsch #3"); Assert.AreEqual("Teststring", cont.EmbeddedType.StringVar, "StringVar falsch #3"); Assert.AreEqual(0xabc, cont.EmbeddedType.Uint16Var, "Uint16Var falsch #3"); Assert.AreEqual(0x12341234, cont.EmbeddedType.Uint32Var, "Uint32Var falsch #3"); Assert.AreEqual(0x143214321, cont.EmbeddedType.Uint64Var, "Uint64Var falsch #3"); Assert.AreEqual(EnumType.drei, cont.EmbeddedType.EnumVar, "EnumVar falsch #3"); Assert.AreEqual(Guid.Empty, cont.EmbeddedType.EmptyGuidVar, "EmptyGuidVar falsch #3"); Assert.AreEqual(DateTime.MinValue, cont.EmbeddedType.EmptyDateTimeVar, "EmptyDateTimeVar falsch #3"); Assert.Null(cont.EmbeddedType.NullString, "Empty String falsch #1"); }