public void WhenCreatedThenSetTheComponentClass()
        {
            var mapdoc = new HbmMapping();
            var component = new HbmCompositeMapKey();
            new ComponentMapKeyMapper(typeof(ToySkill), component, mapdoc);

            component.Class.Should().Contain("ToySkill");
        }
 public void Component(Action<IComponentMapKeyMapper> mapping)
 {
     if (componentMapKeyMapper == null)
     {
         var hbm = new HbmCompositeMapKey();
         componentMapKeyMapper = new ComponentMapKeyMapper(dictionaryKeyType, hbm, mapDoc);
     }
     mapping(componentMapKeyMapper);
     mapMapping.Item = componentMapKeyMapper.CompositeMapKeyMapping;
 }
        public void CallPropertyMapper()
        {
            var mapdoc = new HbmMapping();
            var component = new HbmCompositeMapKey();
            var mapper = new ComponentMapKeyMapper(typeof(ToySkill), component, mapdoc);
            var called = false;

            mapper.Property(ForClass<ToySkill>.Property(ts => ts.Level), x => called = true);

            called.Should().Be.True();
        }
        public void CanMapProperty()
        {
            var mapdoc = new HbmMapping();
            var component = new HbmCompositeMapKey();
            var mapper = new ComponentMapKeyMapper(typeof(ToySkill), component, mapdoc);

            mapper.Property(ForClass<ToySkill>.Property(ts=> ts.Level), x => { });

            component.Properties.Should().Have.Count.EqualTo(1);
            component.Properties.First().Should().Be.OfType<HbmKeyProperty>();
            component.Properties.First().Name.Should().Be.EqualTo("Level");
        }
 public ComponentMapKeyMapper(Type componentType, HbmCompositeMapKey component, HbmMapping mapDoc)
 {
     this.component = component;
     this.mapDoc = mapDoc;
     component.@class = componentType.GetShortClassName(mapDoc);
 }