public void PromoteNestedPropertyInsertedIntoColumn() { const string sql = "create table Album (" + "Id nvarchar(255) not null primary key, " + "Data ntext not null," + "ProducerName nvarchar(255))"; _fixture = new TestFixture(sql, "Album"); Configure.Promote<Album>(a => a.Producer.Name, "ProducerName"); var album = _fixture.GivenAValidAlbum(); _fixture.InsertDocument(album); var documentData = _fixture.GetDocumentDataById(album.Id); Assert.That(documentData["ProducerName"], Is.EqualTo(album.Producer.Name)); }
public void MultiplePromotedProperties() { const string sql = "create table Album (" + "Id nvarchar(255) not null primary key, " + "Data ntext not null," + "ProducerName nvarchar(255)," + "Artist nvarchar(255))"; _fixture = new TestFixture(sql, "Album"); Configure.Promote<Album>(a => a.Producer.Name, "ProducerName"); Configure.Promote<Album>(a => a.Artist); var album = _fixture.GivenAValidAlbum(); _fixture.InsertDocument(album); Assert.That(_fixture.GetDocumentDataById(album.Id)["ProducerName"], Is.EqualTo(album.Producer.Name)); Assert.That(_fixture.GetDocumentDataById(album.Id)["Artist"], Is.EqualTo(album.Artist)); }
private Album GivenAnInsertedAlbumWithPromotedReleaseDate() { const string sql = "create table Album (" + "Id nvarchar(255) not null primary key, " + "Data ntext not null," + "ReleaseDate nvarchar(255))"; _fixture = new TestFixture(sql, "Album"); Configure.Promote<Album>(a => a.ReleaseDate, "ReleaseDate"); var album = _fixture.GivenAValidAlbum(); _fixture.InsertDocument(album); return album; }