Exemplo n.º 1
0
        protected override void Initialize()
        {
            var nas = new NotAuditedSubclassEntity {
                Str = "nae", OtherStr = "super str", NotAuditedStr = "not audited str"
            };
            var ae = new AuditedMethodSubclassEntity {
                Str = "ae", OtherStr = "super str", SubAuditedStr = "audited str"
            };

            //revision 1
            using (var tx = Session.BeginTransaction())
            {
                id1_1 = (int)Session.Save(ae);
                id2_1 = (int)Session.Save(nas);
                tx.Commit();
            }

            //revision 2
            using (var tx = Session.BeginTransaction())
            {
                ae.Str            = "ae new";
                ae.SubAuditedStr  = "audited str new";
                nas.Str           = "nae new";
                nas.NotAuditedStr = "not aud str new";
                tx.Commit();
            }
        }
Exemplo n.º 2
0
        public void VerifyHistoryOfAudited()
        {
            var ver1 = new AuditedMethodSubclassEntity {
                Id = id1_1, Str = "ae", OtherStr = "super str", SubAuditedStr = "audited str"
            };
            var ver2 = new AuditedMethodSubclassEntity {
                Id = id1_1, Str = "ae new", OtherStr = "super str", SubAuditedStr = "audited str new"
            };

            var rev1 = AuditReader().Find <AuditedMethodSubclassEntity>(id1_1, 1);
            var rev2 = AuditReader().Find <AuditedMethodSubclassEntity>(id1_1, 2);

            //this property is not audited on superclass
            rev1.OtherStr.Should().Be.Null();
            rev2.OtherStr.Should().Be.Null();

            rev1.Should().Be.EqualTo(ver1);
            rev2.Should().Be.EqualTo(ver2);
        }