public void VerifyHistoryOfId0() { var ent1 = AuditReader().Find <DefaultValueComponentTestEntity>(id0, 1); var ent2 = AuditReader().Find <DefaultValueComponentTestEntity>(id0, 2); var expectedVer1 = new DefaultValueComponentTestEntity { Id = id0, Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = null } }; var expectedVer2 = new DefaultValueComponentTestEntity { Id = id0, Comp1 = new DefaultValueComponent1 { Str1 = "upd-c1-str1", Comp2 = null } }; ent1.Should().Be.EqualTo(expectedVer1); ent2.Should().Be.EqualTo(expectedVer2); }
protected override void Initialize() { var cte0 = new DefaultValueComponentTestEntity(); var cte1 = new DefaultValueComponentTestEntity { Comp1 = new DefaultValueComponent1 { Str1 = "c1-str1", Comp2 = null } }; var cte2 = new DefaultValueComponentTestEntity { Comp1 = new DefaultValueComponent1 { Str1 = "c1-str1", Comp2 = new DefaultValueComponent2 { Str1 = "c2-str1", Str2 = "c2-str2" } } }; var cte3 = new DefaultValueComponentTestEntity { Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = "c2-str1", Str2 = "c2-str2" } } }; var cte4 = new DefaultValueComponentTestEntity { Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = null, Str2 = "c2-str2" } } }; var cte5 = new DefaultValueComponentTestEntity { Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = "c2-str1", Str2 = null } } }; var cte6 = new DefaultValueComponentTestEntity { Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = null, Str2 = null } } }; //revision 1 using (var tx = Session.BeginTransaction()) { id0 = (int)Session.Save(cte0); id1 = (int)Session.Save(cte1); id2 = (int)Session.Save(cte2); id3 = (int)Session.Save(cte3); id4 = (int)Session.Save(cte4); id5 = (int)Session.Save(cte5); id6 = (int)Session.Save(cte6); tx.Commit(); } //revision 2 using (var tx = Session.BeginTransaction()) { cte0.Comp1 = new DefaultValueComponent1 { Str1 = "upd-c1-str1", Comp2 = null }; cte1.Comp1 = new DefaultValueComponent1 { Str1 = null, Comp2 = new DefaultValueComponent2 { Str1 = "upd-c2-str1", Str2 = "upd-c2-str2" } }; cte2.Comp1.Comp2.Str1 = "upd-c2-str1"; cte3.Comp1.Comp2.Str1 = "upd-c2-str1"; cte4.Comp1.Comp2.Str1 = "upd-c2-str1"; cte5.Comp1.Comp2.Str1 = "upd-c2-str1"; cte6.Comp1.Comp2.Str1 = "upd-c2-str1"; tx.Commit(); } }