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 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 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>(); }