KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
How would you test this scenario? I've just started looking into NHibernate and having my first bash at TDD. So far I've really enjoyed it and have been using fluent-Nhibernate for my mapping of the classes. However I seem to be hitting a dead end when it comes to using the VerifyTheMappings method on PersistenceSpecification. Essentially I have two classes, Recipient and RecipientList. The RecipientList class has a mapping to the Recipient with a fluent "HasMany" relationship: public class RecipientListMap : ClassMap<RecipientList> { public RecipientListMap() { Id(x => x.ID); Map(x => x.ApplicationID); Map(x => x.Name); Map(x => x.IsDeleted); HasMany<Recipient>(x => x.Recipients).WithKeyColumn("RecipientListID").AsList().LazyLoad(); } } However when I use the following code in my test: private IList<Recipient> _recipients = new List<Recipient>() { new Recipient { FirstName = "Joe", LastName = "Bloggs", Email = "joe@bloggs.com", IsDeleted = false }, new Recipient { FirstName = "John", LastName = "Doe", Email = "john@doe.com", IsDeleted = false }, new Recipient { FirstName = "Jane", LastName = "Smith", Email = "john@smith.com", IsDeleted = false } }; [Test] public void Can_Add_RecipientList_To_Database() { new PersistenceSpecification<RecipientList>(Session) .CheckProperty(x => x.Name, "My List") .CheckProperty(x => x.Columns, "My columns") .CheckProperty(x => x.IsDeleted, false) .CheckProperty(x => x.ApplicationID, Guid.NewGuid()) .CheckProperty(x => x.Recipients, _recipients) .VerifyTheMappings(); } The following error occurs: failed: System.ApplicationEx
Tags (comma-separated)
Save Edits
Cancel