public void WhenCallKeyMapperThenKeyMapperIsNotNull() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Key(km => km.Should().Not.Be.Null()); }
public void WhenCallKeyMapperThenKeyMapperIsNotNull() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Key(km => Assert.That(km, Is.Not.Null)); }
public void CanSetFetch() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Fetch(FetchKind.Select); Assert.That(hbmJoin.fetch, Is.EqualTo(HbmJoinFetch.Select)); }
public void CanSetOptional() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Optional(true); Assert.That(hbmJoin.optional, Is.True); }
public void CanSetInverse() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Inverse(true); Assert.That(hbmJoin.inverse, Is.True); }
public void CanSetSchema() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Schema("pizza"); hbmJoin.schema.Should().Be("pizza"); }
public void CanSetCatalog() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Catalog("pizza"); hbmJoin.catalog.Should().Be("pizza"); }
public void CanSetFetch() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Fetch(FetchKind.Select); hbmJoin.fetch.Should().Be(HbmJoinFetch.Select); }
public void CanSetTable() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Table(" Pizza "); hbmJoin.table.Should().Be("Pizza"); }
public void CanSetInverse() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Inverse(true); hbmJoin.inverse.Should().Be.True(); }
public void CanSetCatalog() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Catalog("pizza"); Assert.That(hbmJoin.catalog, Is.EqualTo("pizza")); }
public void CanSetTable() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Table(" Pizza "); Assert.That(hbmJoin.table, Is.EqualTo("Pizza")); }
public void CanSetOptional() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Optional(true); hbmJoin.optional.Should().Be.True(); }
public void WhenAddPropertyThenAddItem() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Property(For <MyClass> .Property(mc => mc.Something), x => { }); Assert.That(hbmJoin.Properties.Count(), Is.EqualTo(1)); }
public void WhenSetTableNameEmptyThenThrows() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Executing(x => x.Table(null)).Throws <ArgumentNullException>(); mapper.Executing(x => x.Table("")).Throws <ArgumentOutOfRangeException>(); mapper.Executing(x => x.Table(" ")).Throws <ArgumentOutOfRangeException>(); }
public void WhenSetTableNameEmptyThenThrows() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); Assert.That(() => mapper.Table(null), Throws.TypeOf <ArgumentNullException>()); Assert.That(() => mapper.Table(""), Throws.TypeOf <ArgumentOutOfRangeException>()); Assert.That(() => mapper.Table(" "), Throws.TypeOf <ArgumentOutOfRangeException>()); }
public void WhenAddPropertyThenAddItem() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Property(For <MyClass> .Property(mc => mc.Something), x => { }); hbmJoin.Properties.Should().Have.Count.EqualTo(1); }
public void CanSetSqlSubselect() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Subselect("blah"); Assert.That(hbmJoin.Subselect, Is.Not.Null); Assert.That(hbmJoin.subselect.Text[0], Is.EqualTo("blah")); }
public void CallKeyMapper() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); var keyMapperCalled = false; mapper.Key(km => keyMapperCalled = true); keyMapperCalled.Should().Be.True(); }
public void CanSetSqlSubselect() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.Subselect("blah"); hbmJoin.Subselect.Should().Not.Be.Null(); hbmJoin.subselect.Text[0].Should().Be("blah"); }
public void SetSqlDelete() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.SqlDelete("blah"); hbmJoin.SqlDelete.Should().Not.Be.Null(); hbmJoin.SqlDelete.Text[0].Should().Be("blah"); }
public void SetSqlDelete() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.SqlDelete("blah"); Assert.That(hbmJoin.SqlDelete, Is.Not.Null); Assert.That(hbmJoin.SqlDelete.Text[0], Is.EqualTo("blah")); }
public void CallKeyMapper() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); var keyMapperCalled = false; mapper.Key(km => keyMapperCalled = true); Assert.That(keyMapperCalled, Is.True); }
public void SetSqlDeleteWithCheck() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.SqlDelete("blah", SqlCheck.RowCount); Assert.That(hbmJoin.SqlDelete, Is.Not.Null); Assert.That(hbmJoin.SqlDelete.Text[0], Is.EqualTo("blah")); Assert.That(hbmJoin.SqlDelete.checkSpecified, Is.True); Assert.That(hbmJoin.SqlDelete.check, Is.EqualTo(HbmCustomSQLCheck.Rowcount)); }
public void WhenCallKeyMapperMoreThanOnceThenKeyMapperIsTheSame() { var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); IKeyMapper firstCallInstance = null; IKeyMapper secondCallInstance = null; mapper.Key(km => firstCallInstance = km); mapper.Key(km => secondCallInstance = km); firstCallInstance.Should().Be.SameInstanceAs(secondCallInstance); }
public void WhenTableNameChangesValueThenNotify() { bool eventCalled = false; var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.TableNameChanged += (m, x) => { m.Should().Be.SameInstanceAs(mapper); x.OldName.Should().Be("AA"); x.NewName.Should().Be("Pizza"); eventCalled = true; }; mapper.Table(" Pizza "); eventCalled.Should().Be.True(); }
public void WhenTableNameChangesValueThenNotify() { bool eventCalled = false; var mapdoc = new HbmMapping(); var hbmJoin = new HbmJoin(); var mapper = new JoinMapper(typeof(MyClass), "AA", hbmJoin, mapdoc); mapper.TableNameChanged += (m, x) => { Assert.That(m, Is.SameAs(mapper)); Assert.That(x.OldName, Is.EqualTo("AA")); Assert.That(x.NewName, Is.EqualTo("Pizza")); eventCalled = true; }; mapper.Table(" Pizza "); Assert.That(eventCalled, Is.True); }