Skip to content

Commit fd9d1ec

Browse files
ogorodnikovInfopulseRogerKratz
authored andcommitted
Update ComponentAsIdTest.cs
1 parent c74f7ac commit fd9d1ec

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Src/NHibernate.Envers.Tests/NetSpecific/Integration/ComponentAsId/ComponentAsIdTest.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using NUnit.Framework;
2+
using NHibernate.Envers.Query;
23

34
namespace NHibernate.Envers.Tests.NetSpecific.Integration.ComponentAsId
45
{
@@ -43,6 +44,44 @@ public void ComponentAsIdTestMethod()
4344
});
4445
}
4546

47+
[Test]
48+
public void ComponentAsIdGetAudit()
49+
{
50+
var ent1 = new Entity1
51+
{
52+
Id = 1
53+
};
54+
55+
Save(ent1);
56+
57+
var ent2 = new Entity2()
58+
{
59+
Id = 1
60+
};
61+
62+
Save(ent2);
63+
64+
var udf = new SomeEntUDF
65+
{
66+
Id = new ComponentAsId
67+
{
68+
Key1 = ent1,
69+
Key2 = ent2
70+
},
71+
};
72+
73+
Save(udf);
74+
75+
76+
var history = Session.Auditer().CreateQuery()
77+
.ForRevisionsOfEntity(typeof(SomeEntUDF), false, true)
78+
.Add(AuditEntity.Property("Id.Key1.Id").Eq(ent1.Id))
79+
.GetResultList();
80+
81+
Assert.AreEqual(1, history.Count);
82+
83+
}
84+
4685
void Save(object o)
4786
{
4887
using (var tran = Session.BeginTransaction())

0 commit comments

Comments
 (0)