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>(); }
public void WhenSetMultiColumnsValuesThenAutoassignColumnNames() { 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)")); mapping.Columns.Should().Have.Count.EqualTo(2); mapping.Columns.All(cm => cm.name.Satisfy(n => !string.IsNullOrEmpty(n))); }
public void WhenSetMultiColumnsValuesThenAddColumns() { 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.Name("column1"); cm.Length(50); }, cm => { cm.Name("column2"); cm.SqlType("VARCHAR(10)"); }); mapping.Columns.Should().Have.Count.EqualTo(2); }