Skip to content

Commit d3c1fdb

Browse files
Generate async files
1 parent e2b204a commit d3c1fdb

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/NHibernate.Test/Async/NHSpecificTest/NH3363/FixtureByCode.cs renamed to src/NHibernate.Test/Async/NHSpecificTest/GH3363/FixtureByCode.cs

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,23 @@
1010

1111
using System.Linq;
1212
using NHibernate.Cfg.MappingSchema;
13-
using NHibernate.DomainModel;
1413
using NHibernate.Mapping.ByCode;
1514
using NUnit.Framework;
1615
using NHibernate.Linq;
1716

18-
namespace NHibernate.Test.NHSpecificTest.NH3363
17+
namespace NHibernate.Test.NHSpecificTest.GH3363
1918
{
2019
using System.Threading.Tasks;
2120
/// <summary>
22-
/// Fixture using 'by code' mappings
21+
/// Fixture for wrong statement generated when child classes have same propery name but different type.
2322
/// </summary>
24-
/// <remarks>
25-
/// This fixture is identical to <see cref="Fixture" /> except the <see cref="Entities" /> mapping is performed
26-
/// by code in the GetMappings method, and does not require the <c>Mappings.hbm.xml</c> file. Use this approach
27-
/// if you prefer.
28-
/// </remarks>
2923
[TestFixture]
3024
public class ByCodeFixtureAsync : TestCaseMappingByCode
3125
{
3226
protected override HbmMapping GetMappings()
3327
{
3428
var mapper = new ModelMapper();
35-
29+
3630
mapper.Class<Mother>(rc =>
3731
{
3832
rc.Id(x => x.Id, m => m.Generator(Generators.Identity));
@@ -42,16 +36,18 @@ protected override HbmMapping GetMappings()
4236
mapper.Subclass<Child1>(rc =>
4337
{
4438
rc.Property(x => x.Name);
45-
rc.ManyToOne(x => x.Thing, m =>{
46-
m.NotFound(NotFoundMode.Ignore);
47-
m.Column("thingId");
48-
});
39+
rc.ManyToOne(x => x.Thing, m =>
40+
{
41+
m.NotFound(NotFoundMode.Ignore);
42+
m.Column("thingId");
43+
});
4944
rc.DiscriminatorValue(1);
5045
});
5146
mapper.Subclass<Child2>(rc =>
5247
{
5348
rc.Property(x => x.Name);
54-
rc.ManyToOne(x => x.Thing, m => {
49+
rc.ManyToOne(x => x.Thing, m =>
50+
{
5551
m.NotFound(NotFoundMode.Ignore);
5652
m.Column("thingId");
5753
});
@@ -61,7 +57,7 @@ protected override HbmMapping GetMappings()
6157
{
6258
rc.Id(x => x.Id, m => m.Generator(Generators.Assigned));
6359
rc.Property(x => x.Name);
64-
60+
6561
});
6662
mapper.Class<Thing2>(rc =>
6763
{
@@ -77,11 +73,11 @@ protected override void OnSetUp()
7773
using (var session = OpenSession())
7874
using (var transaction = session.BeginTransaction())
7975
{
80-
var t1 = new Thing1() { Name = "don't care",Id="00001" };
76+
var t1 = new Thing1() { Name = "don't care", Id = "00001" };
8177
session.Save(t1);
82-
var t2 = new Thing2() { Name = "look for this",Id="00002" };
78+
var t2 = new Thing2() { Name = "look for this", Id = "00002" };
8379
session.Save(t2);
84-
var child1 = new Child1 { Name = "Child1",Thing=t1 };
80+
var child1 = new Child1 { Name = "Child1", Thing = t1 };
8581
session.Save(child1);
8682
var child2 = new Child2 { Name = "Child1", Thing = t2 };
8783
session.Save(child2);
@@ -111,7 +107,7 @@ public async Task LookForThingOfTypeThing2Async()
111107
using (var session = OpenSession())
112108
using (var transaction = session.BeginTransaction())
113109
{
114-
var result = await (session.Query<Mother>().Where(k=>k is Child2 && (k as Child2).Thing.Id == "00002").ToListAsync());
110+
var result = await (session.Query<Mother>().Where(k => k is Child2 && (k as Child2).Thing.Id == "00002").ToListAsync());
115111

116112
Assert.That(result, Has.Count.EqualTo(1));
117113
await (transaction.CommitAsync());
@@ -154,5 +150,4 @@ public async Task LookForManyToOneByDescrAsync()
154150
}
155151
}
156152
}
157-
158153
}

0 commit comments

Comments
 (0)