Exemplo n.º 1
0
        public void MissingReference()
        {
            int id1;
            int id2;

            using (SoodaTransaction tran = new SoodaTransaction())
            {
                EightFields o1 = new EightFields();
                EightFields o2 = new EightFields();
                o1.TimeSpan = TimeSpan.FromSeconds(1);
                o2.TimeSpan = TimeSpan.FromSeconds(2);
                id1         = o1.Id;
                id2         = o2.Id;
                o1.Parent   = o2;
                o2.Parent   = o1;
                tran.Commit();
            }

            using (SoodaTransaction tran = new SoodaTransaction())
            {
                tran.CachingPolicy = new Sooda.Caching.SoodaCacheAllPolicy();
                EightFields o1 = EightFields.GetRef(id1);
                EightFields o2 = EightFields.GetRef(id2);
                Assert.AreEqual(o2, o1.Parent);
                Assert.AreEqual(o1, o2.Parent);
                tran.Commit();
            }
        }
Exemplo n.º 2
0
 public void SelectBlob()
 {
     using (new SoodaTransaction())
     {
         byte[] b = (from e in EightFields.Linq() where e.Id == 1 select e.Blob).Single();
         CollectionAssert.AreEqual(new byte[] { 0xf }, b);
     }
 }
Exemplo n.º 3
0
 public void SelectGuid()
 {
     using (new SoodaTransaction())
     {
         Guid g = (from e in EightFields.Linq() where e.Id == 1 select e.Guid).Single();
         Assert.AreEqual(new Guid("757A29AF-2BB2-4974-829A-A944CF741265"), g);
     }
 }
Exemplo n.º 4
0
 public void SelectTimeSpan()
 {
     using (new SoodaTransaction())
     {
         TimeSpan t = (from e in EightFields.Linq() where e.Id == 1 select e.TimeSpan).Single();
         Assert.AreEqual(TimeSpan.FromHours(1), t);
     }
 }
Exemplo n.º 5
0
 public void TimeSpanCompare()
 {
     using (new SoodaTransaction())
     {
         int c = EightFields.Linq().Count(e => e.TimeSpan == TimeSpan.FromHours(1));
         Assert.AreEqual(1, c);
     }
 }
Exemplo n.º 6
0
 public void SelectMinNullableTimeSpan()
 {
     using (new SoodaTransaction())
     {
         TimeSpan?result = EightFields.Linq().Where(e => e.Id == 1).Select(e => (TimeSpan?)e.TimeSpan).Min();
         Assert.AreEqual(TimeSpan.FromHours(1), result);
     }
 }
Exemplo n.º 7
0
 public void MinTimeSpan()
 {
     using (new SoodaTransaction())
     {
         TimeSpan result = EightFields.Linq().Where(e => e.Id == 1).Min(e => e.TimeSpan);
         Assert.AreEqual(TimeSpan.FromHours(1), result);
     }
 }
Exemplo n.º 8
0
        public void TimeSpan()
        {
            int id;

            using (SoodaTransaction tran = new SoodaTransaction())
            {
                EightFields o = new EightFields();
                id         = o.Id;
                o.TimeSpan = System.TimeSpan.FromHours(5);
                tran.Commit();
            }
            using (SoodaTransaction tran = new SoodaTransaction())
            {
                EightFieldsList l = EightFields.GetList(EightFieldsField.TimeSpan == System.TimeSpan.FromHours(5) && EightFieldsField.Id == id);
                Assert.AreEqual(1, l.Count);
                EightFields o = EightFields.Load(id);
                o.MarkForDelete();
                tran.Commit();
            }
        }