public void WhenAssignComponentRelationThenUseHbmCompositeMapKeyElement() { var keyType = typeof(string); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); mapper.Component(mkm => { }); hbmMap.Item.Should().Be.OfType<HbmCompositeMapKey>(); }
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 WhenAssignComponentRelationThenCallActionWithNotNullParameter() { var keyType = typeof(string); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); var called = false; mapper.Component(mkm => { called = true; mkm.Should().Not.Be.Null(); }); called.Should().Be.True(); }
public void WhenAssignComponentRelationThenActionShouldReuseSameInstanceOfMapper() { var keyType = typeof(string); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); IComponentMapKeyMapper parameterCall1 = null; IComponentMapKeyMapper parameterCall2 = null; mapper.Component(mkm => { parameterCall1 = mkm; }); mapper.Component(mkm => { parameterCall2 = mkm; }); parameterCall1.Should().Be.SameInstanceAs(parameterCall2); }
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 WhenAssignManyToManyRelationThenUseHbmMapKeyManyToManyElement() { var keyType = typeof(string); var hbmMap = new HbmMap(); var hbmMapping = new HbmMapping(); var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping); mapper.ManyToMany(mkm => { }); hbmMap.Item.Should().Be.OfType<HbmMapKeyManyToMany>(); }
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 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"); }