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(); }
/// <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(); }
/// <exception cref="System.Exception"></exception> 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(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.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()); 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(); }
/// <exception cref="System.Exception"></exception> public virtual void TestNonNativeAttributes() { TestClass tc = new TestClass (); NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo classInfo = NeoDatis.Odb.OdbConfiguration .GetCoreProvider().GetClassIntrospector().Introspect(tc.GetType(), true).GetMainClassInfo (); AssertEquals(0, classInfo.GetAllNonNativeAttributes().Count); }
public virtual void TestStringPersistence() { NeoDatis.Odb.ODB odb = null; try { odb = Open("date.neodatis"); TestClass tc1 = new TestClass (); tc1.SetString1(string.Empty); odb.Store(tc1); odb.Close(); odb = Open("date.neodatis"); NeoDatis.Odb.Objects<TestClass> l = odb.GetObjects<TestClass>(); AssertEquals(1, l.Count); TestClass tc2 = (TestClass )l.GetFirst(); AssertEquals(string.Empty, tc2.GetString1()); AssertEquals(null, tc2.GetBigDecimal1()); AssertEquals(null, tc2.GetDouble1()); } finally { if (odb != null) { odb.Close(); } } }
public virtual void TestDatePersistence() { NeoDatis.Odb.ODB odb = null; DeleteBase("date.neodatis"); try { odb = Open("date.neodatis"); TestClass tc1 = new TestClass (); tc1.SetDate1(new System.DateTime()); long t1 = tc1.GetDate1().Millisecond; odb.Store(tc1); odb.Close(); odb = Open("date.neodatis"); NeoDatis.Odb.Objects<TestClass> l = odb.GetObjects<TestClass>(); AssertEquals(1, l.Count); TestClass tc2 = (TestClass)l.GetFirst(); AssertEquals(t1, tc2.GetDate1().Millisecond); AssertEquals(tc1.GetDate1(), tc2.GetDate1()); } finally { if (odb != null) { odb.Close(); } } DeleteBase("date.neodatis"); }
public bool Match(TestClass @object) { return true; }
/// <exception cref="System.Exception"></exception> public virtual void TestSimpleInstanceRetrievingWithNQWithNullBoolean() { if (!isLocal || !useSameVmOptimization) { // native must be serializable to be executed in cs mode 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√° ???"); 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_217(); NeoDatis.Odb.Objects<TestClass> l = odb.GetObjects<TestClass>(q); TestClass tc12 = (TestClass )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"); }
/// <exception cref="System.Exception"></exception> public override void SetUp() { base.SetUp(); DeleteBase(BaseName); NeoDatis.Odb.ODB odb = Open(BaseName); long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); int size = 50; for (int i = 0; i < size; i++) { TestClass testClass = new TestClass (); testClass.SetBigDecimal1(new System.Decimal(i)); testClass.SetBoolean1(i % 3 == 0); testClass.SetChar1((char)(i % 5)); testClass.SetDate1(new System.DateTime(start + i)); testClass.SetDouble1(((double)(i % 10)) / size); testClass.SetInt1(size - i); testClass.SetString1("test class " + i); odb.Store(testClass); } // println(testClass.getDouble1() + " | " + testClass.getString1() + // " | " + testClass.getInt1()); odb.Close(); }
/// <exception cref="System.Exception"></exception> public override void SetUp() { base.SetUp(); DeleteBase(BaseName); NeoDatis.Odb.ODB odb = Open(BaseName); long start = NeoDatis.Tool.Wrappers.OdbTime.GetCurrentTimeInMs(); int size = 50; for (int i = 0; i < size; i++) { TestClass tc = new TestClass (); tc.SetBigDecimal1(new System.Decimal(i)); tc.SetBoolean1(i % 3 == 0); tc.SetChar1((char)(i % 5)); tc.SetDate1(new System.DateTime(1000 + start + i)); tc.SetDouble1(((double)(i % 10)) / size); tc.SetInt1(size - i); tc.SetString1("test class " + i); odb.Store(tc); } TestClass testClass = new TestClass (); testClass.SetBigDecimal1(new System.Decimal(190.95)); testClass.SetBoolean1(true); testClass.SetChar1('s'); correctDate = new System.DateTime(); testClass.SetDate1(correctDate); testClass.SetDouble1(190.99); testClass.SetInt1(190); testClass.SetString1("test class with values"); odb.Store(testClass); TestClass testClass2 = new TestClass (); testClass2.SetBigDecimal1(0); testClass2.SetBoolean1(true); testClass2.SetChar1('s'); correctDate = new System.DateTime(); testClass2.SetDate1(correctDate); testClass2.SetDouble1(191.99); testClass2.SetInt1(1901); testClass2.SetString1("test class with null BigDecimal"); odb.Store(testClass2); TestClass testClass3 = new TestClass (); odb.Store(testClass3); odb.Close(); }