Beispiel #1
0
        protected override void Initialize()
        {
            var cmke = new ComponentMapKeyEntity();
            var cte1 = new ComponentTestEntity {
                Comp1 = new Component1 {
                    Str1 = "x1", Str2 = "y2"
                }, Comp2 = new Component2 {
                    Str5 = "a1", Str6 = "b2"
                }
            };
            var cte2 = new ComponentTestEntity {
                Comp1 = new Component1 {
                    Str1 = "x1", Str2 = "y2"
                }, Comp2 = new Component2 {
                    Str5 = "a1", Str6 = "b2"
                }
            };

            //Revision 1
            using (var tx = Session.BeginTransaction())
            {
                cte1_id = (int)Session.Save(cte1);
                cte2_id = (int)Session.Save(cte2);
                cmke.IdMap[cte1.Comp1] = cte1;
                cmke_id = (int)Session.Save(cmke);
                tx.Commit();
            }
            //revision 2
            using (var tx = Session.BeginTransaction())
            {
                cmke.IdMap[cte2.Comp1] = cte2;
                tx.Commit();
            }
        }
Beispiel #2
0
        public void VerifyHistoryOf3()
        {
            var ver1 = new ComponentTestEntity {
                Id = id3, Comp1 = new Component1 {
                    Str1 = "a3", Str2 = "b3"
                }
            };
            var ver2 = new ComponentTestEntity {
                Id = id3, Comp1 = new Component1 {
                    Str1 = "a3", Str2 = "b3'"
                }
            };

            Assert.AreEqual(ver1, AuditReader().Find <ComponentTestEntity>(id3, 1));
            Assert.AreEqual(ver1, AuditReader().Find <ComponentTestEntity>(id3, 2));
            Assert.AreEqual(ver2, AuditReader().Find <ComponentTestEntity>(id3, 3));
            Assert.AreEqual(ver2, AuditReader().Find <ComponentTestEntity>(id3, 4));
        }
Beispiel #3
0
        public void VerifyHistoryOf2()
        {
            var ver1 = new ComponentTestEntity {
                Id = id2, Comp1 = new Component1 {
                    Str1 = "a2", Str2 = "b2"
                }
            };
            var ver2 = new ComponentTestEntity {
                Id = id2, Comp1 = new Component1 {
                    Str1 = "a2'", Str2 = "b2"
                }
            };

            Assert.AreEqual(ver1, AuditReader().Find <ComponentTestEntity>(id2, 1));
            Assert.AreEqual(ver2, AuditReader().Find <ComponentTestEntity>(id2, 2));
            Assert.AreEqual(ver2, AuditReader().Find <ComponentTestEntity>(id2, 3));
            Assert.IsNull(AuditReader().Find <ComponentTestEntity>(id2, 4));
        }
Beispiel #4
0
        public void VerifyHistoryOf1()
        {
            var ver1 = new ComponentTestEntity {
                Id = id1, Comp1 = new Component1 {
                    Str1 = "a", Str2 = "b"
                }
            };
            var ver2 = new ComponentTestEntity {
                Id = id1, Comp1 = new Component1 {
                    Str1 = "a'", Str2 = "b'"
                }
            };

            Assert.AreEqual(ver1, AuditReader().Find <ComponentTestEntity>(id1, 1));
            Assert.AreEqual(ver2, AuditReader().Find <ComponentTestEntity>(id1, 2));
            Assert.AreEqual(ver2, AuditReader().Find <ComponentTestEntity>(id1, 3));
            Assert.AreEqual(ver2, AuditReader().Find <ComponentTestEntity>(id1, 4));
        }
Beispiel #5
0
        public void VerifyHistoryOf4()
        {
            var ver1 = new ComponentTestEntity {
                Id = id4
            };
            var ver2 = new ComponentTestEntity {
                Id = id4, Comp1 = new Component1 {
                    Str1 = "n"
                }
            };
            var ver3 = new ComponentTestEntity {
                Id = id4
            };

            Assert.AreEqual(ver1, AuditReader().Find <ComponentTestEntity>(id4, 1));
            Assert.AreEqual(ver2, AuditReader().Find <ComponentTestEntity>(id4, 2));
            Assert.AreEqual(ver3, AuditReader().Find <ComponentTestEntity>(id4, 3));
            Assert.AreEqual(ver3, AuditReader().Find <ComponentTestEntity>(id4, 4));
        }
Beispiel #6
0
        protected override void Initialize()
        {
            var imke = new ComponentMapKeyEntity();
            var cte1 = new ComponentTestEntity
            {
                Comp1 = new Component1 {
                    Str1 = "x1", Str2 = "y2"
                },
                Comp2 = new Component2 {
                    Str5 = "a1", Str6 = "b2"
                }
            };
            var cte2 = new ComponentTestEntity
            {
                //changed from Envers test here. Doubt that org test is doing the right thing...
                Comp1 = new Component1 {
                    Str1 = "x11", Str2 = "y2"
                },
                Comp2 = new Component2 {
                    Str5 = "a1", Str6 = "b2"
                }
            };

            using (var tx = Session.BeginTransaction())
            {
                cte1_id = (int)Session.Save(cte1);
                cte2_id = (int)Session.Save(cte2);
                imke.IdMap[cte1.Comp1] = cte1;
                cmke_id = (int)Session.Save(imke);
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                imke.IdMap[cte2.Comp1] = cte2;
                tx.Commit();
            }
        }
Beispiel #7
0
        protected override void Initialize()
        {
            var cte1 = new ComponentTestEntity
            {
                Comp1 = new Component1 {
                    Str1 = "a", Str2 = "b"
                },
                Comp2 = new Component2 {
                    Str5 = "x", Str6 = "y"
                }
            };
            var cte2 = new ComponentTestEntity
            {
                Comp1 = new Component1 {
                    Str1 = "a2", Str2 = "b2"
                },
                Comp2 = new Component2 {
                    Str5 = "x2", Str6 = "y2"
                }
            };
            var cte3 = new ComponentTestEntity
            {
                Comp1 = new Component1 {
                    Str1 = "a3", Str2 = "b3"
                },
                Comp2 = new Component2 {
                    Str5 = "x3", Str6 = "y3"
                }
            };
            var cte4 = new ComponentTestEntity();

            using (var tx = Session.BeginTransaction())
            {
                id1 = (int)Session.Save(cte1);
                id2 = (int)Session.Save(cte2);
                id3 = (int)Session.Save(cte3);
                id4 = (int)Session.Save(cte4);
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                cte1.Comp1 = new Component1 {
                    Str1 = "a'", Str2 = "b'"
                };
                cte2.Comp1.Str1 = "a2'";
                cte3.Comp2.Str6 = "y3'";
                cte4.Comp1      = new Component1 {
                    Str1 = "n"
                };
                cte4.Comp2 = new Component2 {
                    Str5 = "m"
                };
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                cte1.Comp2 = new Component2 {
                    Str5 = "x'", Str6 = "y'"
                };
                cte3.Comp1.Str2 = "b3'";
                cte4.Comp1      = null;
                cte4.Comp2      = null;
                tx.Commit();
            }
            using (var tx = Session.BeginTransaction())
            {
                Session.Delete(cte2);
                tx.Commit();
            }
        }