public void WhenSetMoreSyncThenAddAll() { var mapdoc = new HbmMapping(); var rc = new JoinedSubclassMapper(typeof(InheritedSimple), mapdoc); rc.Synchronize("T1", "T2", "T3", null); mapdoc.JoinedSubclasses[0].Synchronize.Select(x => x.table).Should().Have.SameValuesAs("T1", "T2", "T3"); }
public void CanSetPersister() { var mapdoc = new HbmMapping(); var rc = new JoinedSubclassMapper(typeof(InheritedSimple), mapdoc); rc.Persister<JoinedSubclassEntityPersister>(); mapdoc.JoinedSubclasses[0].Persister.Should().Contain("JoinedSubclassEntityPersister"); }
public void CanSetPersister() { var mapdoc = new HbmMapping(); var rc = new JoinedSubclassMapper(typeof(InheritedSimple), mapdoc); rc.Persister<JoinedSubclassEntityPersister>(); Assert.That(mapdoc.JoinedSubclasses[0].Persister, Is.StringContaining("JoinedSubclassEntityPersister")); }
public void WhenSetSyncWithNullThenDoesNotThrows() { var mapdoc = new HbmMapping(); var rc = new JoinedSubclassMapper(typeof(InheritedSimple), mapdoc); rc.Executing(x => x.Synchronize(null)).NotThrows(); }
public void WhenSetSyncWithNullThenDoesNotThrows() { var mapdoc = new HbmMapping(); var rc = new JoinedSubclassMapper(typeof(InheritedSimple), mapdoc); Assert.That(() => rc.Synchronize(null), Throws.Nothing); }
public void WhenSetSyncMixedWithNullAndEmptyThenAddOnlyValid() { var mapdoc = new HbmMapping(); var rc = new JoinedSubclassMapper(typeof(InheritedSimple), mapdoc); rc.Synchronize("", " ATable ", " ", null); Assert.That(mapdoc.JoinedSubclasses[0].Synchronize.Single().table, Is.EqualTo("ATable")); }
public void WhenSetMoreSyncThenAddAll() { var mapdoc = new HbmMapping(); var rc = new JoinedSubclassMapper(typeof(InheritedSimple), mapdoc); rc.Synchronize("T1", "T2", "T3", null); Assert.That(mapdoc.JoinedSubclasses[0].Synchronize.Select(x => x.table), Is.EquivalentTo(new [] {"T1", "T2", "T3"})); }
public void CanSetPersister() { var mapdoc = new HbmMapping(); var rc = new JoinedSubclassMapper(typeof(InheritedSimple), mapdoc); rc.Persister <JoinedSubclassEntityPersister>(); mapdoc.JoinedSubclasses[0].Persister.Should().Contain("JoinedSubclassEntityPersister"); }
public void WhenSetMoreSyncThenAddAll() { var mapdoc = new HbmMapping(); var rc = new JoinedSubclassMapper(typeof(InheritedSimple), mapdoc); rc.Synchronize("T1", "T2", "T3", null); Assert.That(mapdoc.JoinedSubclasses[0].Synchronize.Select(x => x.table), Is.EquivalentTo(new [] { "T1", "T2", "T3" })); }
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 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 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 SetSelectBeforeUpdate() { var subClass = typeof(Inherited); var mapdoc = new HbmMapping(); var mapper = new JoinedSubclassMapper(subClass, mapdoc); mapper.SelectBeforeUpdate(true); var hbmEntity = mapdoc.JoinedSubclasses[0]; hbmEntity.SelectBeforeUpdate.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 SetDynamicInsert() { var subClass = typeof(Inherited); var mapdoc = new HbmMapping(); var mapper = new JoinedSubclassMapper(subClass, mapdoc); mapper.DynamicInsert(true); var hbmEntity = mapdoc.JoinedSubclasses[0]; hbmEntity.DynamicInsert.Should().Be(true); }
public void SetSqlSubselect() { var subClass = typeof(Inherited); var mapdoc = new HbmMapping(); var mapper = new JoinedSubclassMapper(subClass, mapdoc); mapper.Subselect("blah"); var hbmEntity = mapdoc.JoinedSubclasses[0]; hbmEntity.Subselect.Should().Not.Be.Null(); hbmEntity.subselect.Text[0].Should().Be("blah"); }
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 JoinedSubclass <TEntity>(Action <IJoinedSubclassMapper <TEntity> > classMapping) where TEntity : class { var sc = new JoinedSubclassMapper <TEntity>(mapping); classMapping(sc); }