public void WhenSetSyncWithNullThenDoesNotThrows()
        {
            var mapdoc = new HbmMapping();
            var rc     = new SubclassMapper(typeof(InheritedSimple), mapdoc);

            rc.Executing(x => x.Synchronize(null)).NotThrows();
        }
		public void WhenSetMoreSyncThenAddAll()
		{
			var mapdoc = new HbmMapping();
			var rc = new SubclassMapper(typeof(InheritedSimple), mapdoc);
			rc.Synchronize("T1", "T2", "T3", null);
			mapdoc.SubClasses[0].Synchronize.Select(x => x.table).Should().Have.SameValuesAs("T1", "T2", "T3");
		}
예제 #3
0
        public void WhenSetSyncWithNullThenDoesNotThrows()
        {
            var mapdoc = new HbmMapping();
            var rc     = new SubclassMapper(typeof(InheritedSimple), mapdoc);

            Assert.That(() => rc.Synchronize(null), Throws.Nothing);
        }
		public void WhenSetMoreSyncThenAddAll()
		{
			var mapdoc = new HbmMapping();
			var rc = new SubclassMapper(typeof(InheritedSimple), mapdoc);
			rc.Synchronize("T1", "T2", "T3", null);
			Assert.That(mapdoc.SubClasses[0].Synchronize.Select(x => x.table), Is.EquivalentTo(new [] {"T1", "T2", "T3"}));
		}
예제 #5
0
		public void CanSetPersister()
		{
			var mapdoc = new HbmMapping();
			var rc = new SubclassMapper(typeof(HineritedSimple), mapdoc);
			rc.Persister<SingleTableEntityPersister>();
			Assert.That(mapdoc.SubClasses[0].Persister, Is.StringContaining("SingleTableEntityPersister"));
		}
		public void WhenSetSyncMixedWithNullAndEmptyThenAddOnlyValid()
		{
			var mapdoc = new HbmMapping();
			var rc = new SubclassMapper(typeof(InheritedSimple), mapdoc);
			rc.Synchronize("", "  ATable   ", "     ", null);
			mapdoc.SubClasses[0].Synchronize.Single().table.Should().Be("ATable");
		}
예제 #7
0
		public void CanSetPersister()
		{
			var mapdoc = new HbmMapping();
			var rc = new SubclassMapper(typeof(HineritedSimple), mapdoc);
			rc.Persister<SingleTableEntityPersister>();
			mapdoc.SubClasses[0].Persister.Should().Contain("SingleTableEntityPersister");
		}
        public void WhenSetSyncMixedWithNullAndEmptyThenAddOnlyValid()
        {
            var mapdoc = new HbmMapping();
            var rc     = new SubclassMapper(typeof(InheritedSimple), mapdoc);

            rc.Synchronize("", "  ATable   ", "     ", null);
            mapdoc.SubClasses[0].Synchronize.Single().table.Should().Be("ATable");
        }
        public void WhenSetMoreSyncThenAddAll()
        {
            var mapdoc = new HbmMapping();
            var rc     = new SubclassMapper(typeof(InheritedSimple), mapdoc);

            rc.Synchronize("T1", "T2", "T3", null);
            mapdoc.SubClasses[0].Synchronize.Select(x => x.table).Should().Have.SameValuesAs("T1", "T2", "T3");
        }
예제 #10
0
        public void SetWrongProxy()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            Executing.This(() => mapper.Proxy(typeof(Z))).Should().Throw <MappingException>();
        }
예제 #11
0
        public void CanSetPersister()
        {
            var mapdoc = new HbmMapping();
            var rc     = new SubclassMapper(typeof(HineritedSimple), mapdoc);

            rc.Persister <SingleTableEntityPersister>();
            Assert.That(mapdoc.SubClasses[0].Persister, Does.Contain("SingleTableEntityPersister"));
        }
예제 #12
0
        public void WhenSetMoreSyncThenAddAll()
        {
            var mapdoc = new HbmMapping();
            var rc     = new SubclassMapper(typeof(InheritedSimple), mapdoc);

            rc.Synchronize("T1", "T2", "T3", null);
            Assert.That(mapdoc.SubClasses[0].Synchronize.Select(x => x.table), Is.EquivalentTo(new [] { "T1", "T2", "T3" }));
        }
예제 #13
0
        public void SetWrongProxy()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            ActionAssert.Throws <MappingException>(() => mapper.Proxy(typeof(Z)));
        }
예제 #14
0
        public void SetEntityName()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            mapper.EntityName("pepe");

            var hbmEntity = mapdoc.SubClasses[0];

            hbmEntity.EntityName.Should().Be("pepe");
        }
예제 #15
0
        public void SetSelectBeforeUpdate()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            mapper.SelectBeforeUpdate(true);

            var hbmEntity = mapdoc.SubClasses[0];

            hbmEntity.SelectBeforeUpdate.Should().Be(true);
        }
예제 #16
0
        public void SetBatchSize()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            mapper.BatchSize(10);

            var hbmEntity = mapdoc.SubClasses[0];

            hbmEntity.BatchSize.Should().Be(10);
        }
예제 #17
0
        public void SetDynamicInsert()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            mapper.DynamicInsert(true);

            var hbmEntity = mapdoc.SubClasses[0];

            hbmEntity.DynamicInsert.Should().Be(true);
        }
예제 #18
0
        public void SetProxy()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            mapper.Proxy(subClass);

            var hbmEntity = mapdoc.SubClasses[0];

            hbmEntity.Proxy.Should().Contain("Inherited");
        }
		public void WhenDefineMoreJoinsThenTableNameShouldBeUnique()
		{
			var mapdoc = new HbmMapping();
			var mapper = new SubclassMapper(typeof(Inherited), mapdoc);

			mapper.Join("T1", x => { });
			mapper.Join("T2", x => { });

			var hbmClass = mapdoc.SubClasses[0];
			Assert.That(hbmClass.Joins.Count(), Is.EqualTo(2));
			Assert.That(hbmClass.Joins.Select(x => x.table), Is.Unique);
		}
		public void WhenDefineMoreJoinsThenTableNameShouldBeUnique()
		{
			var mapdoc = new HbmMapping();
			var mapper = new SubclassMapper(typeof(Inherited), mapdoc);

			mapper.Join("T1", x => { });
			mapper.Join("T2", x => { });

			var hbmClass = mapdoc.SubClasses[0];
			hbmClass.Joins.Should().Have.Count.EqualTo(2);
			hbmClass.Joins.Select(x => x.table).Should().Have.UniqueValues();
		}
예제 #21
0
        public void SetSqlDelete()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            mapper.SqlDelete("blah");

            var hbmEntity = mapdoc.SubClasses[0];

            hbmEntity.SqlDelete.Should().Not.Be.Null();
            hbmEntity.SqlDelete.Text[0].Should().Be("blah");
        }
		public void WhenDefineJoinThenAddJoinWithTableNameAndKey()
		{
			var mapdoc = new HbmMapping();
			var mapper = new SubclassMapper(typeof(Inherited), mapdoc);

			mapper.Join("MyTable", x => { });

			var hbmClass = mapdoc.SubClasses[0];
			var hbmJoin = hbmClass.Joins.Single();
			Assert.That(hbmJoin.table, Is.EqualTo("MyTable"));
			Assert.That(hbmJoin.key, Is.Not.Null);
			Assert.That(hbmJoin.key.column1, Is.Not.Null);
		}
        public void WhenDefineMoreJoinsThenTableNameShouldBeUnique()
        {
            var mapdoc = new HbmMapping();
            var mapper = new SubclassMapper(typeof(Inherited), mapdoc);

            mapper.Join("T1", x => { });
            mapper.Join("T2", x => { });

            var hbmClass = mapdoc.SubClasses[0];

            hbmClass.Joins.Should().Have.Count.EqualTo(2);
            hbmClass.Joins.Select(x => x.table).Should().Have.UniqueValues();
        }
		public void WhenDefineJoinThenCallJoinMapper()
		{
			var mapdoc = new HbmMapping();
			var mapper = new SubclassMapper(typeof(Inherited), mapdoc);
			var called = false;
			mapper.Join("MyTable", x =>
			{
				Assert.That(x, Is.Not.Null);
				called = true;
			});

			Assert.That(called, Is.True);
		}
예제 #25
0
        public void SetLoader()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            mapper.Loader("blah");

            var hbmEntity = mapdoc.SubClasses[0];

            hbmEntity.SqlLoader.Should().Not.Be.Null();
            hbmEntity.SqlLoader.queryref.Should().Be("blah");
        }
		public void WhenDefineJoinThenAddJoinWithTableNameAndKey()
		{
			var mapdoc = new HbmMapping();
			var mapper = new SubclassMapper(typeof(Inherited), mapdoc);

			mapper.Join("MyTable", x => { });

			var hbmClass = mapdoc.SubClasses[0];
			var hbmJoin = hbmClass.Joins.Single();
			hbmJoin.table.Should().Be("MyTable");
			hbmJoin.key.Should().Not.Be.Null();
			hbmJoin.key.column1.Should().Not.Be.Null();
		}
		public void WhenDefineJoinThenCallJoinMapper()
		{
			var mapdoc = new HbmMapping();
			var mapper = new SubclassMapper(typeof(Inherited), mapdoc);
			var called = false;
			mapper.Join("MyTable", x =>
			{
				x.Should().Not.Be.Null();
				called = true;
			});

			called.Should().Be.True();
		}
        public void WhenDefineMoreJoinsThenTableNameShouldBeUnique()
        {
            var mapdoc = new HbmMapping();
            var mapper = new SubclassMapper(typeof(Inherited), mapdoc);

            mapper.Join("T1", x => { });
            mapper.Join("T2", x => { });

            var hbmClass = mapdoc.SubClasses[0];

            Assert.That(hbmClass.Joins.Count(), Is.EqualTo(2));
            Assert.That(hbmClass.Joins.Select(x => x.table), Is.Unique);
        }
		public void WhenDefineMoreJoinsWithSameIdThenUseSameJoinMapperInstance()
		{
			var mapdoc = new HbmMapping();
			var mapper = new SubclassMapper(typeof(Inherited), mapdoc);
			IJoinMapper firstCallInstance = null;
			IJoinMapper secondCallInstance = null;

			mapper.Join("T1", x => firstCallInstance = x);
			mapper.Join("T1", x => secondCallInstance = x);

			Assert.That(firstCallInstance, Is.SameAs(secondCallInstance));
			var hbmClass = mapdoc.SubClasses[0];
			Assert.That(hbmClass.Joins.Count(), Is.EqualTo(1));
		}
		public void WhenDefineMoreJoinsWithSameIdThenUseSameJoinMapperInstance()
		{
			var mapdoc = new HbmMapping();
			var mapper = new SubclassMapper(typeof(Inherited), mapdoc);
			IJoinMapper firstCallInstance = null;
			IJoinMapper secondCallInstance = null;

			mapper.Join("T1", x => firstCallInstance = x);
			mapper.Join("T1", x => secondCallInstance = x);

			firstCallInstance.Should().Be.SameInstanceAs(secondCallInstance);
			var hbmClass = mapdoc.SubClasses[0];
			hbmClass.Joins.Should().Have.Count.EqualTo(1);
		}
        public void WhenDefineJoinThenAddJoinWithTableNameAndKey()
        {
            var mapdoc = new HbmMapping();
            var mapper = new SubclassMapper(typeof(Inherited), mapdoc);

            mapper.Join("MyTable", x => { });

            var hbmClass = mapdoc.SubClasses[0];
            var hbmJoin  = hbmClass.Joins.Single();

            hbmJoin.table.Should().Be("MyTable");
            hbmJoin.key.Should().Not.Be.Null();
            hbmJoin.key.column1.Should().Not.Be.Null();
        }
        public void WhenDefineJoinThenCallJoinMapper()
        {
            var mapdoc = new HbmMapping();
            var mapper = new SubclassMapper(typeof(Inherited), mapdoc);
            var called = false;

            mapper.Join("MyTable", x =>
            {
                x.Should().Not.Be.Null();
                called = true;
            });

            called.Should().Be.True();
        }
        public void WhenDefineJoinThenCallJoinMapper()
        {
            var mapdoc = new HbmMapping();
            var mapper = new SubclassMapper(typeof(Inherited), mapdoc);
            var called = false;

            mapper.Join("MyTable", x =>
            {
                Assert.That(x, Is.Not.Null);
                called = true;
            });

            Assert.That(called, Is.True);
        }
        public void WhenDefineJoinThenAddJoinWithTableNameAndKey()
        {
            var mapdoc = new HbmMapping();
            var mapper = new SubclassMapper(typeof(Inherited), mapdoc);

            mapper.Join("MyTable", x => { });

            var hbmClass = mapdoc.SubClasses[0];
            var hbmJoin  = hbmClass.Joins.Single();

            Assert.That(hbmJoin.table, Is.EqualTo("MyTable"));
            Assert.That(hbmJoin.key, Is.Not.Null);
            Assert.That(hbmJoin.key.column1, Is.Not.Null);
        }
        public void WhenDefineMoreJoinsWithSameIdThenUseSameJoinMapperInstance()
        {
            var         mapdoc             = new HbmMapping();
            var         mapper             = new SubclassMapper(typeof(Inherited), mapdoc);
            IJoinMapper firstCallInstance  = null;
            IJoinMapper secondCallInstance = null;

            mapper.Join("T1", x => firstCallInstance  = x);
            mapper.Join("T1", x => secondCallInstance = x);

            firstCallInstance.Should().Be.SameInstanceAs(secondCallInstance);
            var hbmClass = mapdoc.SubClasses[0];

            hbmClass.Joins.Should().Have.Count.EqualTo(1);
        }
        public void WhenDefineMoreJoinsWithSameIdThenUseSameJoinMapperInstance()
        {
            var         mapdoc             = new HbmMapping();
            var         mapper             = new SubclassMapper(typeof(Inherited), mapdoc);
            IJoinMapper firstCallInstance  = null;
            IJoinMapper secondCallInstance = null;

            mapper.Join("T1", x => firstCallInstance  = x);
            mapper.Join("T1", x => secondCallInstance = x);

            Assert.That(firstCallInstance, Is.SameAs(secondCallInstance));
            var hbmClass = mapdoc.SubClasses[0];

            Assert.That(hbmClass.Joins.Count(), Is.EqualTo(1));
        }
예제 #37
0
        public void SetLazy()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            mapper.Lazy(true);

            var hbmEntity = mapdoc.SubClasses[0];

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

            mapper.Lazy(false);
            hbmEntity.UseLazy.Should().Be(false);
        }
예제 #38
0
        public void SetDiscriminatorValue()
        {
            var subClass = typeof(Inherited);
            var mapdoc   = new HbmMapping();
            var mapper   = new SubclassMapper(subClass, mapdoc);

            mapper.DiscriminatorValue("blah");

            var hbmEntity = mapdoc.SubClasses[0];

            hbmEntity.DiscriminatorValue.Should().Be("blah");

            mapper.DiscriminatorValue(null);
            hbmEntity.DiscriminatorValue.Should().Be("null");
        }
		public void WhenSetSyncWithNullThenDoesNotThrows()
		{
			var mapdoc = new HbmMapping();
			var rc = new SubclassMapper(typeof(InheritedSimple), mapdoc);
			Assert.That(() => rc.Synchronize(null), Throws.Nothing);
		}
예제 #40
0
        public void Subclass <TEntity>(Action <ISubclassMapper <TEntity> > classMapping) where TEntity : class
        {
            var sc = new SubclassMapper <TEntity>(mapping);

            classMapping(sc);
        }
		public void WhenSetSyncWithNullThenDoesNotThrows()
		{
			var mapdoc = new HbmMapping();
			var rc = new SubclassMapper(typeof(InheritedSimple), mapdoc);
			rc.Executing(x => x.Synchronize(null)).NotThrows();
		}