Skip to content

Commit f5cde37

Browse files
committed
basic tests for #113 - mapping simple properties in inheritance hierarchy
1 parent 1daf18a commit f5cde37

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using FluentNHibernate.Testing.Automapping;
6+
using NUnit.Framework;
7+
8+
namespace FluentNHibernate.Testing.AutoMapping
9+
{
10+
[TestFixture]
11+
public class InheritanceTests: BaseAutoMapFixture
12+
{
13+
[Test]
14+
public void AutoMapSimpleProperties()
15+
{
16+
Model<ThirdLevel>();
17+
18+
Test<ThirdLevel>(mapping =>
19+
{
20+
mapping.Element("//id").HasAttribute("name", "Id");
21+
mapping.Element("//property[@name='Rate']/column").HasAttribute("name", "Rate");
22+
mapping.Element("//property[@name='SecondRate']/column").HasAttribute("name", "SecondRate");
23+
});
24+
}
25+
}
26+
27+
public abstract class Base1
28+
{
29+
public virtual int Id { get; protected set; }
30+
public abstract void Foo(int x);
31+
}
32+
33+
public class Derived1: Base1
34+
{
35+
public virtual Decimal Rate { get; set; }
36+
public override void Foo(int x)
37+
{
38+
}
39+
40+
public string GetSomething()
41+
{
42+
return Environment.NewLine;
43+
}
44+
}
45+
46+
public class SecondLevel: Derived1
47+
{
48+
public virtual Double SecondRate { get; set; }
49+
}
50+
51+
public class ThirdLevel: SecondLevel
52+
{
53+
public virtual Boolean Flag { get; set; }
54+
}
55+
}

0 commit comments

Comments
 (0)