Skip to content

Commit bab942a

Browse files
committed
Do something useful in the test
While #755 is not fixed we have to use IDictionary as a dynamic component property type
1 parent 4431485 commit bab942a

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

src/NHibernate.Test/NHSpecificTest/NH2783/Bar.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Collections;
12
using System.Collections.Generic;
23

34
namespace NHibernate.Test.NHSpecificTest.NH2783
@@ -8,6 +9,6 @@ class Bar
89

910
public virtual int DynValString2 { get; set; }
1011

11-
public virtual IDictionary<string, object> MyProps { get; set; } = new Dictionary<string, object>();
12+
public virtual IDictionary MyProps { get; set; } = new Dictionary<string, object>();
1213
}
1314
}

src/NHibernate.Test/NHSpecificTest/NH2783/Fixture.cs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,32 @@ namespace NHibernate.Test.NHSpecificTest.NH2783
55
[TestFixture]
66
public class Fixture : BugTestCase
77
{
8+
private object _fooId;
9+
private object _barId;
10+
811
protected override void OnSetUp()
912
{
13+
using (var session = OpenSession())
14+
using (var transaction = session.BeginTransaction())
15+
{
16+
var bar = new Bar
17+
{
18+
MyProps =
19+
{
20+
["DynValString2"] = "a"
21+
}
22+
};
23+
_barId = session.Save(bar);
24+
_fooId = session.Save(
25+
new Foo
26+
{
27+
MyProps =
28+
{
29+
["DynPointer"] = bar
30+
}
31+
});
32+
transaction.Commit();
33+
}
1034
}
1135

1236
protected override void OnTearDown()
@@ -26,8 +50,17 @@ protected override void OnTearDown()
2650
}
2751

2852
[Test]
29-
public void DoNothing()
53+
public void CanReadDynPointerFromFoo()
3054
{
55+
using (var session = OpenSession())
56+
using (session.BeginTransaction())
57+
{
58+
var foo = session.Get<Foo>(_fooId);
59+
var bar = foo.MyProps["DynPointer"];
60+
Assert.That(bar, Is.Not.Null);
61+
Assert.That(bar, Is.InstanceOf<Bar>());
62+
Assert.That(bar, Has.Property("Id").EqualTo(_barId));
63+
}
3164
}
3265
}
3366
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Collections;
12
using System.Collections.Generic;
23

34
namespace NHibernate.Test.NHSpecificTest.NH2783
@@ -6,6 +7,6 @@ class Foo
67
{
78
public virtual int Id { get; set; }
89

9-
public virtual IDictionary<string, object> MyProps { get; set; } = new Dictionary<string, object>();
10+
public virtual IDictionary MyProps { get; set; } = new Dictionary<string, object>();
1011
}
1112
}

0 commit comments

Comments
 (0)