コード例 #1
0
ファイル: TestCriteriaQuery5.cs プロジェクト: ekicyou/pasta
        public virtual void TestCriteriaWithDate()
		{
            string baseName = GetBaseName();
			NeoDatis.Odb.ODB odb = Open(baseName);
			for (int i = 0; i < 10; i++)
			{
				NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass
					();
				tc.SetInt1(i);
				odb.Store(tc);
			}
			odb.Close();
			odb = Open(baseName);
			NeoDatis.Odb.Objects<TestClass> os = odb.GetObjects<TestClass>(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
				(Where
				.Ge("int1", 0)));
			AssertEquals(10, os.Count);
			int j = 0;
			while (os.HasNext())
			{
				NeoDatis.Odb.Test.VO.Attribute.TestClass tc = (NeoDatis.Odb.Test.VO.Attribute.TestClass
					)os.Next();
				AssertEquals(j, tc.GetInt1());
				j++;
			}
			odb.Close();
		}
コード例 #2
0
        /// <exception cref="System.Exception"></exception>
        public virtual void TestCriteriaWithDate()
        {
            DeleteBase(BaseName);
            NeoDatis.Odb.ODB odb = Open(BaseName);
            for (int i = 0; i < 10; i++)
            {
                NeoDatis.Odb.Test.VO.Attribute.TestClass tc = new NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                                  ();
                tc.SetInt1(i);
                odb.Store(tc);
            }
            odb.Close();
            odb = Open(BaseName);
            NeoDatis.Odb.Objects <TestClass> os = odb.GetObjects <TestClass>(new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery
                                                                                 (Where
                                                                                 .Ge("int1", 0)));
            AssertEquals(10, os.Count);
            int j = 0;

            while (os.HasNext())
            {
                NeoDatis.Odb.Test.VO.Attribute.TestClass tc = (NeoDatis.Odb.Test.VO.Attribute.TestClass
                                                               )os.Next();
                AssertEquals(j, tc.GetInt1());
                j++;
            }
            odb.Close();
        }
コード例 #3
0
ファイル: StorageEngineTest.cs プロジェクト: ekicyou/pasta
        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();
		}
コード例 #4
0
ファイル: StorageEngineTest.cs プロジェクト: ekicyou/pasta
		// 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");
		}