Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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();
- }
- }
- private IList<Recipient> _recipients = new List<Recipient>()
- {
- new Recipient { FirstName = "Joe", LastName = "Bloggs", Email = "[email protected]", IsDeleted = false },
- new Recipient { FirstName = "John", LastName = "Doe", Email = "[email protected]", IsDeleted = false },
- new Recipient { FirstName = "Jane", LastName = "Smith", Email = "[email protected]", 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();
- }
- failed: System.ApplicationException : Expected 'System.Collections.Generic.List`1[Project.Data.Domains.Recipients.Recipient]' but got 'NHibernate.Collection.Generic.PersistentGenericBag`1[Project.Data.Domains.Recipients.Recipient]' for Property 'Recipients'
Add Comment
Please, Sign In to add comment