public void SetEntityName()
        {
            var subClass = typeof(Inherited);
            var mapdoc = new HbmMapping();
            var mapper = new JoinedSubclassMapper(subClass, mapdoc);
            mapper.EntityName("pepe");

            var hbmEntity = mapdoc.JoinedSubclasses[0];
            hbmEntity.EntityName.Should().Be("pepe");
        }
        public void SetDynamicUpdate()
        {
            var subClass = typeof(Inherited);
            var mapdoc = new HbmMapping();
            var mapper = new JoinedSubclassMapper(subClass, mapdoc);
            mapper.DynamicUpdate(true);

            var hbmEntity = mapdoc.JoinedSubclasses[0];

            hbmEntity.DynamicUpdate.Should().Be(true);
        }
        public void SetBatchSize()
        {
            var subClass = typeof(Inherited);
            var mapdoc = new HbmMapping();
            var mapper = new JoinedSubclassMapper(subClass, mapdoc);
            mapper.BatchSize(10);

            var hbmEntity = mapdoc.JoinedSubclasses[0];

            hbmEntity.BatchSize.Should().Be(10);
        }
        public void CallKeyMapper()
        {
            var subClass = typeof(Inherited);
            var mapdoc = new HbmMapping();
            var mapper = new JoinedSubclassMapper(subClass, mapdoc);
            var keyMapperCalled = false;

            mapper.Key(km => keyMapperCalled = true);

            keyMapperCalled.Should().Be.True();
        }
 public void WhenSetExtendsWithWrongBaseTypeThenThrow()
 {
     var subClass = typeof(Inherited);
     var mapdoc = new HbmMapping { assembly = subClass.Assembly.FullName, @namespace = subClass.Namespace };
     var mapper = new JoinedSubclassMapper(subClass, mapdoc);
     ActionAssert.Throws<ArgumentOutOfRangeException>(() => mapper.Extends(typeof(Z)));
     ActionAssert.Throws<ArgumentOutOfRangeException>(() => mapper.Extends(typeof(Inherited2)));
 }
 public void WhenSetExtendsExplicitlyThenSetDifferentBaseType()
 {
     var subClass = typeof(Inherited2);
     var mapdoc = new HbmMapping { assembly = subClass.Assembly.FullName, @namespace = subClass.Namespace };
     var mapper = new JoinedSubclassMapper(subClass, mapdoc);
     mapper.Extends(typeof(EntitySimple));
     mapdoc.JoinedSubclasses[0].extends.Should().Be.EqualTo(typeof(EntitySimple).Name);
 }
        public void SetLoader()
        {
            var subClass = typeof(Inherited);
            var mapdoc = new HbmMapping();
            var mapper = new JoinedSubclassMapper(subClass, mapdoc);
            mapper.Loader("blah");

            var hbmEntity = mapdoc.JoinedSubclasses[0];

            hbmEntity.SqlLoader.Should().Not.Be.Null();
            hbmEntity.SqlLoader.queryref.Should().Be("blah");
        }
        public void SetLazy()
        {
            var subClass = typeof(Inherited);
            var mapdoc = new HbmMapping();
            var mapper = new JoinedSubclassMapper(subClass, mapdoc);
            mapper.Lazy(true);

            var hbmEntity = mapdoc.JoinedSubclasses[0];

            hbmEntity.UseLazy.Should().Not.Have.Value();

            mapper.Lazy(false);
            hbmEntity.UseLazy.Should().Be(false);
        }
 public void SetWrongProxy()
 {
     var subClass = typeof(Inherited);
     var mapdoc = new HbmMapping();
     var mapper = new JoinedSubclassMapper(subClass, mapdoc);
     ActionAssert.Throws<MappingException>(() => mapper.Proxy(typeof(Z)));
 }
        public void SetSqlUpdate()
        {
            var subClass = typeof(Inherited);
            var mapdoc = new HbmMapping();
            var mapper = new JoinedSubclassMapper(subClass, mapdoc);
            mapper.SqlUpdate("blah");

            var hbmEntity = mapdoc.JoinedSubclasses[0];

            hbmEntity.SqlUpdate.Should().Not.Be.Null();
            hbmEntity.SqlUpdate.Text[0].Should().Be("blah");
        }
        public void SetProxy()
        {
            var subClass = typeof(Inherited);
            var mapdoc = new HbmMapping();
            var mapper = new JoinedSubclassMapper(subClass, mapdoc);
            mapper.Proxy(subClass);

            var hbmEntity = mapdoc.JoinedSubclasses[0];
            hbmEntity.Proxy.Should().Contain("Inherited");
        }