开发者

Fluent NHibernate Test VerifyTheMappings

开发者 https://www.devze.com 2023-01-15 21:39 出处:网络
Given the following [Test] public void VerifyMappings() { new PersistenceSpecification<Address>(Session)

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

精彩评论

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