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 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 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 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); }