开发者

Fluent NHibernate Test VerifyTheMappings

Given the following

    [Test]
    public void VerifyMappings()
    {
        new PersistenceSpecification<Address>(Session)
            .CheckProperty(x => x.AddressLine1, "190 House 12")
            .VerifyTheMappings();
    }

The following will attempt to do a read and write to the datbase, however it leaves the record. Is it possible to delete this record using the f开发者_开发技巧luent framework?


Just use something like this in your [TearDown]:

var currentSession = NHibernateSession.Current;
if (currentSession.Transaction.IsActive) {
    currentSession.Flush();
    currentSession.Transaction.Rollback();
}

That will rollback the current transaction.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜