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 WhenAssignManyToManyRelationThenCallActionWithNotNullParameter()
        {
            var keyType = typeof(string);
            var hbmMap = new HbmMap();
            var hbmMapping = new HbmMapping();
            var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping);
            var called = false;
            mapper.ManyToMany(mkm =>
            {
                called = true;
                mkm.Should().Not.Be.Null();
            });

            called.Should().Be.True();
        }
        public void WhenAssignManyToManyRelationThenActionShouldReuseSameInstanceOfMapper()
        {
            var keyType = typeof(string);
            var hbmMap = new HbmMap();
            var hbmMapping = new HbmMapping();
            var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping);
            IMapKeyManyToManyMapper parameterCall1 = null;
            IMapKeyManyToManyMapper parameterCall2 = null;
            mapper.ManyToMany(mkm =>
            {
                parameterCall1 = mkm;
            });
            mapper.ManyToMany(mkm =>
            {
                parameterCall2 = mkm;
            });

            parameterCall1.Should().Be.SameInstanceAs(parameterCall2);
        }
        public void WhenAssignManyToManyRelationThenAssignClass()
        {
            var keyType = typeof(MyClass);
            var hbmMap = new HbmMap();
            var hbmMapping = new HbmMapping();
            var mapper = new MapKeyRelation(keyType, hbmMap, hbmMapping);
            mapper.ManyToMany(mkm => { });

            var keyElement = (HbmMapKeyManyToMany)hbmMap.Item;
            keyElement.Class.Should().Not.Be.Null();
            keyElement.Class.Should().Contain("MyClass");
        }
        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");
        }