Exemplo n.º 1
0
        /// <exception cref="Java.IO.UnsupportedEncodingException"></exception>
        public virtual void Test1()
        {
            NeoDatis.Odb.ODB odb      = null;
            string           baseName = GetBaseName();

            Java.Util.Locale defaultLocale = Java.Util.Locale.GetDefault();
            try
            {
                odb = Open(baseName);
                NeoDatis.Odb.OdbConfiguration.SetLatinDatabaseCharacterEncoding();
                Java.Util.Locale brLocale = new Java.Util.Locale("pt", "BR");
                Java.Util.Locale.SetDefault(brLocale);
                NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                  ();
                tc.SetBigDecimal1(new System.Decimal(5.3));
                Println(tc.GetBigDecimal1().ToString());
                odb.Store(tc);
                odb.Close();
                odb = Open(baseName);
                NeoDatis.Odb.Objects <NeoDatis.Odb.Test.VO.Attribute.TestClass> objects = odb.GetObjects
                                                                                              (typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass));
                AssertEquals(1, objects.Count);
                AssertEquals(new System.Decimal(5.3), objects.GetFirst().GetBigDecimal1());
            }
            finally
            {
                if (odb != null && !odb.IsClosed())
                {
                    odb.Close();
                }
                NeoDatis.Odb.OdbConfiguration.SetDatabaseCharacterEncoding(null);
                Java.Util.Locale.SetDefault(defaultLocale);
            }
        }
Exemplo n.º 2
0
		/// <exception cref="Java.IO.UnsupportedEncodingException"></exception>
		public virtual void Test1()
		{
			NeoDatis.Odb.ODB odb = null;
			string baseName = GetBaseName();
			Java.Util.Locale defaultLocale = Java.Util.Locale.GetDefault();
			try
			{
				odb = Open(baseName);
				NeoDatis.Odb.OdbConfiguration.SetLatinDatabaseCharacterEncoding();
				Java.Util.Locale brLocale = new Java.Util.Locale("pt", "BR");
				Java.Util.Locale.SetDefault(brLocale);
				NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass
					();
				tc.SetBigDecimal1(new System.Decimal(5.3));
				Println(tc.GetBigDecimal1().ToString());
				odb.Store(tc);
				odb.Close();
				odb = Open(baseName);
				NeoDatis.Odb.Objects<NeoDatis.Odb.Test.VO.Attribute.TestClass> objects = odb.GetObjects
					(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass));
				AssertEquals(1, objects.Count);
				AssertEquals(new System.Decimal(5.3), objects.GetFirst().GetBigDecimal1());
			}
			finally
			{
				if (odb != null && !odb.IsClosed())
				{
					odb.Close();
				}
				NeoDatis.Odb.OdbConfiguration.SetDatabaseCharacterEncoding(null);
				Java.Util.Locale.SetDefault(defaultLocale);
			}
		}
Exemplo n.º 3
0
 /// <exception cref="System.Exception"></exception>
 public virtual void TestStringPersistence()
 {
     NeoDatis.Odb.ODB odb = null;
     try
     {
         odb = Open("date.neodatis");
         NeoDatis.Odb.Test.VO.Attribute.TestClass tc1 = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                            ();
         tc1.SetString1(string.Empty);
         odb.Store(tc1);
         odb.Close();
         odb = Open("date.neodatis");
         NeoDatis.Odb.Objects l = odb.GetObjects(typeof(NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                        ));
         AssertEquals(1, l.Count);
         NeoDatis.Odb.Test.VO.Attribute.TestClass tc2 = (NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                         )l.GetFirst();
         AssertEquals(string.Empty, tc2.GetString1());
         AssertEquals(null, tc2.GetBigDecimal1());
         AssertEquals(null, tc2.GetDouble1());
     }
     finally
     {
         if (odb != null)
         {
             odb.Close();
         }
     }
 }