public void WhenAssignElementRelationThenUseHbmMapKeyElement() { var keyType = typeof(string); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); mapper.Element(mkm => { }); hbmMap.Item.Should().Be.OfType <HbmMapKey>(); }
public void WhenAssignElementRelationThenCallActionWithNotNullParameter() { var keyType = typeof(string); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); var called = false; mapper.Element(mkm => { called = true; mkm.Should().Not.Be.Null(); }); called.Should().Be.True(); }
public void WhenAssignElementRelationThenAssignType() { var keyType = typeof(string); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); mapper.Element(mkm => { }); var keyElement = (HbmMapKey)hbmMap.Item; keyElement.Type.name.Should().Not.Be.Null(); keyElement.Type.name.Should().Contain("String"); }
public void WhenAssignComponentRelationThenAssignClass() { var keyType = typeof(MyClass); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); mapper.Component(mkm => { }); var keyElement = (HbmCompositeMapKey)hbmMap.Item; keyElement.Class.Should().Not.Be.Null(); keyElement.Class.Should().Contain("MyClass"); }
public void WhenAssignElementRelationThenActionShouldReuseSameInstanceOfHbmElement() { var keyType = typeof(string); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); mapper.Element(mkm => mkm.Column("pizza")); mapper.Element(mkm => mkm.Length(30)); var keyElement = (HbmMapKey)hbmMap.Item; keyElement.length.Should().Be("30"); keyElement.column.Should().Be("pizza"); }
public void WhenAssignManyToManyRelationActionShouldReuseSameInstanceOfHbmElement() { var keyType = typeof(string); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); mapper.ManyToMany(mkm => mkm.Column("pizza")); mapper.ManyToMany(mkm => mkm.ForeignKey("FK")); var keyElement = (HbmMapKeyManyToMany)hbmMap.Item; keyElement.foreignkey.Should().Be("FK"); keyElement.column.Should().Be("pizza"); }
public void WhenAssignElementRelationThenActionShouldReuseSameInstanceOfMapper() { var keyType = typeof(string); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); IMapKeyMapper parameterCall1 = null; IMapKeyMapper parameterCall2 = null; mapper.Element(mkm => { parameterCall1 = mkm; }); mapper.Element(mkm => { parameterCall2 = mkm; }); parameterCall1.Should().Be.SameInstanceAs(parameterCall2); }