public virtual void TestDate1() { string baseName = GetBaseName(); SetUp(baseName); NeoDatis.Odb.ODB odb = Open(baseName); NeoDatis.Odb.Test.Query.Criteria.MyDates myDates = new NeoDatis.Odb.Test.Query.Criteria.MyDates (); System.DateTime d1 = new System.DateTime(); Thread.Sleep(100); System.DateTime d2 = new System.DateTime(); Thread.Sleep(100); System.DateTime d3 = new System.DateTime(); myDates.SetDate1(d1); myDates.SetDate2(d3); myDates.SetI(5); odb.Store(myDates); odb.Close(); odb = Open(baseName); NeoDatis.Odb.Core.Query.IQuery query = new CriteriaQuery (typeof(MyDates), Where .And().Add(Where.Le("date1", d2)).Add(Where .Ge("date2", d2)).Add(Where.Equal("i", 5))); NeoDatis.Odb.Objects <MyDates> objects = odb.GetObjects <MyDates>(query); AssertEquals(1, objects.Count); odb.Close(); }
/// <exception cref="System.Exception"></exception> public virtual void TestDate1() { NeoDatis.Odb.ODB odb = Open("criteria.neodatis"); NeoDatis.Odb.Test.Query.Criteria.MyDates myDates = new NeoDatis.Odb.Test.Query.Criteria.MyDates (); System.DateTime d1 = new System.DateTime(); Java.Lang.Thread.Sleep(100); System.DateTime d2 = new System.DateTime(); Java.Lang.Thread.Sleep(100); System.DateTime d3 = new System.DateTime(); myDates.SetDate1(d1); myDates.SetDate2(d3); myDates.SetI(5); odb.Store(myDates); odb.Close(); odb = Open("criteria.neodatis"); NeoDatis.Odb.Core.Query.IQuery query = new NeoDatis.Odb.Impl.Core.Query.Criteria.CriteriaQuery (typeof(NeoDatis.Odb.Test.Query.Criteria.MyDates), NeoDatis.Odb.Core.Query.Criteria.Where .And().Add(NeoDatis.Odb.Core.Query.Criteria.Where.Le("date1", d2)).Add(NeoDatis.Odb.Core.Query.Criteria.Where .Ge("date2", d2)).Add(NeoDatis.Odb.Core.Query.Criteria.Where.Equal("i", 5))); NeoDatis.Odb.Objects objects = odb.GetObjects(query); AssertEquals(1, objects.Count); odb.Close(); }
public virtual void TestDate1() { string baseName = GetBaseName(); SetUp(baseName); NeoDatis.Odb.ODB odb = Open(baseName); NeoDatis.Odb.Test.Query.Criteria.MyDates myDates = new NeoDatis.Odb.Test.Query.Criteria.MyDates (); System.DateTime d1 = new System.DateTime(); Thread.Sleep(100); System.DateTime d2 = new System.DateTime(); Thread.Sleep(100); System.DateTime d3 = new System.DateTime(); myDates.SetDate1(d1); myDates.SetDate2(d3); myDates.SetI(5); odb.Store(myDates); odb.Close(); odb = Open(baseName); NeoDatis.Odb.Core.Query.IQuery query = new CriteriaQuery (typeof(MyDates), Where .And().Add(Where.Le("date1", d2)).Add(Where .Ge("date2", d2)).Add(Where.Equal("i", 5))); NeoDatis.Odb.Objects<MyDates> objects = odb.GetObjects<MyDates>(query); AssertEquals(1, objects.Count); odb.Close(); }