Reputation: 1277
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 fluent framework?
Upvotes: 1
Views: 374
Reputation: 1735
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.
Upvotes: 3