Exemple #1
0
        protected override void Initialize()
        {
            var nas = new NotAuditedSubclassEntity {
                Str = "nae", OtherStr = "super str", NotAuditedStr = "not audited str"
            };
            var ae = new AuditedAllSubclassEntity {
                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();
            }
        }
Exemple #2
0
        public void VerifyHistoryOfAudited()
        {
            var ver1 = new AuditedAllSubclassEntity {
                Id = id1_1, Str = "ae", OtherStr = "super str", SubAuditedStr = "audited str"
            };
            var ver2 = new AuditedAllSubclassEntity {
                Id = id1_1, Str = "ae new", OtherStr = "super str", SubAuditedStr = "audited str new"
            };

            var rev1 = AuditReader().Find <AuditedAllSubclassEntity>(id1_1, 1);
            var rev2 = AuditReader().Find <AuditedAllSubclassEntity>(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);
        }