Skip to content

Commit 325cf1e

Browse files
committed
Flesh out the tests to verify that the expected subclasses exist in the generated mapping
1 parent 102240e commit 325cf1e

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/FluentNHibernate.Testing/PersistenceModelTests/SubclassPersistenceModelTests.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,15 @@ public void CanBuildConfigurationForTablePerType()
213213
model.Add(new TablePerType.TPT_MiddleMap());
214214
model.Add(new TablePerType.TPT_MiddleSubclassMap());
215215

216-
model.BuildMappings();
216+
var classMapping = model.BuildMappings();
217+
classMapping.Count().ShouldEqual(1);
218+
219+
var top = classMapping.First().Classes.First();
220+
top.Subclasses.Count().ShouldEqual(2);
221+
222+
var middle = top.Subclasses.SingleOrDefault(sc => sc.Type == typeof(TablePerType.TPT_Middle));
223+
middle.ShouldNotBeNull();
224+
middle.Subclasses.Count().ShouldEqual(1);
217225
}
218226

219227
[Test]
@@ -225,7 +233,15 @@ public void CanBuildConfigurationForTablePerTypeWithInterfaces()
225233
model.Add(new TablePerTypeWithInterfaces.TPTWI_IMiddleMap());
226234
model.Add(new TablePerTypeWithInterfaces.TPTWI_MiddleSubclassMap());
227235

228-
model.BuildMappings();
236+
var classMapping = model.BuildMappings();
237+
classMapping.Count().ShouldEqual(1);
238+
239+
var top = classMapping.First().Classes.First();
240+
top.Subclasses.Count().ShouldEqual(2);
241+
242+
var middle = top.Subclasses.SingleOrDefault(sc => sc.Type == typeof(TablePerTypeWithInterfaces.TPTWI_IMiddle));
243+
middle.ShouldNotBeNull();
244+
middle.Subclasses.Count().ShouldEqual(1);
229245
}
230246
}
231247

0 commit comments

Comments
 (0)