예제 #1
0
        public void VerifyHistoryOf3()
        {
            var ver1 = new BasicTestEntity2 {
                Id = id3, Str1 = "z"
            };

            Assert.AreEqual(ver1, AuditReader().Find <BasicTestEntity2>(id3, 1));
            Assert.IsNull(AuditReader().Find <BasicTestEntity2>(id3, 2));
            Assert.IsNull(AuditReader().Find <BasicTestEntity2>(id3, 3));
            Assert.IsNull(AuditReader().Find <BasicTestEntity2>(id3, 4));
        }
        public void VerifyHistoryOf1()
        {
            var ver1 = new BasicTestEntity2 {
                Id = id1, Str1 = "x"
            };
            var ver2 = new BasicTestEntity2 {
                Id = id1, Str1 = "y"
            };

            Assert.AreEqual(ver1, AuditReader().Find <BasicTestEntity2>(id1, 1));
            Assert.AreEqual(ver2, AuditReader().Find <BasicTestEntity2>(id1, 2));
        }
 private int addNewEntity(string str1, string str2)
 {
     using (var tx = Session.BeginTransaction())
     {
         var bte = new BasicTestEntity2 {
             Str1 = str1, Str2 = str2
         };
         Session.Save(bte);
         tx.Commit();
         return(bte.Id);
     }
 }
예제 #4
0
        protected override void Initialize()
        {
            var bte1 = new BasicTestEntity2 {
                Str1 = "x", Str2 = "a"
            };
            var bte2 = new BasicTestEntity2 {
                Str1 = "y", Str2 = "b"
            };
            var bte3 = new BasicTestEntity2 {
                Str1 = "z", Str2 = "c"
            };

            using (var tx = Session.BeginTransaction())
            {
                id1 = (int)Session.Save(bte1);
                id2 = (int)Session.Save(bte2);
                id3 = (int)Session.Save(bte3);
                tx.Commit();
            }
            //revision 2
            using (var tx = Session.BeginTransaction())
            {
                bte1.Str1 = "x2";
                bte2.Str2 = "b2";
                Session.Delete(bte3);
                tx.Commit();
            }
            //revision 3
            using (var tx = Session.BeginTransaction())
            {
                Session.Delete(bte2);
                tx.Commit();
            }
            //revision 4
            using (var tx = Session.BeginTransaction())
            {
                Session.Delete(bte1);
                tx.Commit();
            }
        }