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(); }
// 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"); }
/// <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(); }