public void WhenAssignCascadeStyleThenNotThrows() { var hbmMapping = new HbmMapping(); var hbm = new HbmKeyManyToOne(); var mapper = new KeyManyToOneMapper(null, hbm, hbmMapping); mapper.Executing(m => m.Cascade(Cascade.Persist | Cascade.Remove)).NotThrows(); }
public void WhenSetFetchModeToJoinThenNotThrows() { var hbmMapping = new HbmMapping(); var member = typeof(MyComponent).GetProperty("Relation"); var mapping = new HbmKeyManyToOne(); var mapper = new KeyManyToOneMapper(member, mapping, hbmMapping); mapper.Executing(m => m.Fetch(FetchKind.Join)).NotThrows(); }
public void WhenForceClassRelationToIncompatibleTypeThenThrows() { var hbmMapping = new HbmMapping(); var member = typeof(MyComponent).GetProperty("TheOtherRelation"); var mapping = new HbmKeyManyToOne(); var mapper = new KeyManyToOneMapper(member, mapping, hbmMapping); mapper.Executing(m => m.Class(typeof(Whatever))).Throws <ArgumentOutOfRangeException>(); }
public void AfterSetMultiColumnsCantSetSimpleColumn() { var hbmMapping = new HbmMapping(); var member = typeof(MyComponent).GetProperty("Relation"); var mapping = new HbmKeyManyToOne(); var mapper = new KeyManyToOneMapper(member, mapping, hbmMapping); mapper.Columns(cm => cm.Length(50), cm => cm.SqlType("VARCHAR(10)")); mapper.Executing(m => m.Column(cm => cm.Length(50))).Throws <MappingException>(); }