Ejemplo n.º 1
0
        public virtual void TestSimpleInstance()
		{
			DeleteBase("t-simple-instance.neodatis");
			NeoDatis.Odb.ODB odb = Open("t-simple-instance.neodatis");
			TestClass tc1 = new TestClass
				();
			tc1.SetBigDecimal1(new System.Decimal(1.123456));
			tc1.SetBoolean1(true);
			tc1.SetChar1('d');
			tc1.SetDouble1(154.78998989);
			tc1.SetInt1(78964);
			tc1.SetString1("Ola chico como vc est\u00E1 ???");
			tc1.SetDate1(DateTime.Now);
			tc1.SetBoolean2(false);
			TestClass tc2 = new TestClass
				();
			tc2.SetBigDecimal1(new System.Decimal(1.1234565454));
			tc2.SetBoolean1(false);
			tc2.SetChar1('c');
			tc2.SetDouble1(78454.8779);
			tc2.SetInt1(1254);
			tc2.SetString1("Ola chico como ca va ???");
			tc2.SetDate1(DateTime.Now);
			tc2.SetBoolean2(true);
			odb.Store(tc1);
			odb.Store(tc2);
			odb.Close();
			odb = Open("t-simple-instance.neodatis");
			NeoDatis.Odb.Objects<TestClass> l = odb.GetObjects<TestClass>(true);
			TestClass tc12 = l.GetFirst();
			// println("#### " + l.size() + " : " + l);
			AssertEquals(tc1.GetBigDecimal1(), tc12.GetBigDecimal1());
			AssertEquals(tc1.GetString1(), tc12.GetString1());
			AssertEquals(tc1.GetChar1(), tc12.GetChar1());
			AssertEquals(tc1.GetDouble1(), tc12.GetDouble1());
			AssertEquals(tc1.GetInt1(), tc12.GetInt1());
			AssertEquals(tc1.IsBoolean1(), tc12.IsBoolean1());
			AssertEquals(false, tc12.GetBoolean2());
            Console.WriteLine(" Date is " + tc12.GetDate1());
			if (l.Count < 3)
			{
				AssertEquals(tc1.GetDate1(), tc12.GetDate1());
			}
			l.Next();
			TestClass tc22 = (TestClass
				)l.Next();
			AssertEquals(tc2.GetBigDecimal1(), tc22.GetBigDecimal1());
			AssertEquals(tc2.GetString1(), tc22.GetString1());
			AssertEquals(tc2.GetChar1(), tc22.GetChar1());
			AssertEquals(tc2.GetDouble1(), tc22.GetDouble1());
			AssertEquals(tc2.GetInt1(), tc22.GetInt1());
			AssertEquals(tc2.IsBoolean1(), tc22.IsBoolean1());
			AssertEquals(true, tc2.GetBoolean2());
			if (l.Count < 3)
			{
				AssertEquals(tc2.GetDate1(), tc22.GetDate1());
			}
			odb.Close();
		}
Ejemplo n.º 2
0
		// deleteBase("t-simple-instance.neodatis");
		/// <exception cref="System.Exception"></exception>
		public virtual void TestSimpleInstanceRetrievingWithNQ()
		{
			if (!isLocal || !useSameVmOptimization)
			{
				return;
			}
			DeleteBase("t-simple-instance.neodatis");
			NeoDatis.Odb.ODB odb = Open("t-simple-instance.neodatis");
			TestClass tc1 = new TestClass
				();
			tc1.SetBigDecimal1(new System.Decimal(1.123456));
			tc1.SetBoolean1(true);
			tc1.SetChar1('d');
			tc1.SetDouble1(154.78998989);
			tc1.SetInt1(78964);
			tc1.SetString1("Ola chico como vc est\u00E1 ???");
			tc1.SetDate1(new System.DateTime());
			tc1.SetBoolean2(false);
			TestClass tc2 = new TestClass
				();
			tc2.SetBigDecimal1(new System.Decimal(1.1234565454));
			tc2.SetBoolean1(false);
			tc2.SetChar1('c');
			tc2.SetDouble1(78454.8779);
			tc2.SetInt1(1254);
			tc2.SetString1("Ola chico como ca va ???");
			tc2.SetDate1(new System.DateTime());
			tc2.SetBoolean2(true);
			odb.Store(tc1);
			odb.Store(tc2);
			odb.Close();
			odb = Open("t-simple-instance.neodatis");
			NeoDatis.Odb.Core.Query.IQuery q = new _SimpleNativeQuery_146();
			NeoDatis.Odb.Objects<TestClass> l = odb.GetObjects<TestClass>(q);
			TestClass tc12 = l.GetFirst();
			// println("#### " + l.size() + " : " + l);
			AssertEquals(tc1.GetBigDecimal1(), tc12.GetBigDecimal1());
			AssertEquals(tc1.GetString1(), tc12.GetString1());
			AssertEquals(tc1.GetChar1(), tc12.GetChar1());
			AssertEquals(tc1.GetDouble1(), tc12.GetDouble1());
			AssertEquals(tc1.GetInt1(), tc12.GetInt1());
			AssertEquals(tc1.IsBoolean1(), tc12.IsBoolean1());
			AssertEquals(false, tc12.GetBoolean2());
			if (l.Count < 3)
			{
				AssertEquals(tc1.GetDate1(), tc12.GetDate1());
			}
			l.Next();
			TestClass tc22 = (TestClass)l.Next();
			AssertEquals(tc2.GetBigDecimal1(), tc22.GetBigDecimal1());
			AssertEquals(tc2.GetString1(), tc22.GetString1());
			AssertEquals(tc2.GetChar1(), tc22.GetChar1());
			AssertEquals(tc2.GetDouble1(), tc22.GetDouble1());
			AssertEquals(tc2.GetInt1(), tc22.GetInt1());
			AssertEquals(tc2.IsBoolean1(), tc22.IsBoolean1());
			AssertEquals(true, tc2.GetBoolean2());
			if (l.Count < 3)
			{
				AssertEquals(tc2.GetDate1(), tc22.GetDate1());
			}
			odb.Close();
			DeleteBase("t-simple-instance.neodatis");
		}