forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVersionTests.cs
48 lines (43 loc) · 1.07 KB
/
VersionTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using NHibernate.Mapping.ByCode;
using NUnit.Framework;
namespace NHibernate.Test.MappingByCode.ExpliticMappingTests
{
[TestFixture]
public class VersionTests
{
private class MyClass
{
public int Id { get; set; }
public int Version { get; set; }
}
private class MyRoot: MyClass
{
}
[Test]
public void WhenPropertyUsedAsVersionThenRegister()
{
var inspector = new ExplicitlyDeclaredModel();
var mapper = new ModelMapper(inspector);
mapper.Class<MyClass>(
map =>
{
map.Id(x => x.Id, idmap => { });
map.Version(x => x.Version, vm => { });
});
Assert.That(inspector.IsVersion(For<MyClass>.Property(x => x.Version)), Is.True);
}
[Test]
public void WhenPropertyVersionFromBaseEntityThenFindItAsVersion()
{
var inspector = new ExplicitlyDeclaredModel();
var mapper = new ModelMapper(inspector);
mapper.Class<MyClass>(
map =>
{
map.Id(x => x.Id, idmap => { });
map.Version(x => x.Version, vm => { });
});
Assert.That(inspector.IsVersion(For<MyRoot>.Property(x => x.Version)), Is.True);
}
}
}