ITransaction does not inherit IDisposable

Posts   
 
    
rlucassen
User
Posts: 22
Joined: 25-Oct-2013
# Posted on: 12-Feb-2020 20:32:14   

LLBLGEN 5.6.0 SelfService

ITransaction has a Dispose Method but does not inherit Idisposable. Transaction inherits IDisposable but we want to mock the transaction.

We want to create a TransactionFactory so the transaction can be mocked in Tests.

Is it posible to let the ITransaction inherit from IDisposable

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 13-Feb-2020 09:43:45   

We'll look into making this change in the next version.

If possible, try to avoid mocking away data-access, and instead use a real database: it will give you better tests as you'll otherwise will ignore problems that can occur in the database (e.g. fk violations, uc violations, locking issues that lead to deadlocks etc.)

Frans Bouma | Lead developer LLBLGen Pro
rlucassen
User
Posts: 22
Joined: 25-Oct-2013
# Posted on: 13-Feb-2020 14:18:59   

Thanks Otis.

We have separated our Data Access and business logic. in this specific case we needed a transaction to be rolled back when an exception occurs in the business logic. so want unit test if it is actually rolled back.

Data access is tested in the integration tests. So No worries there but thanks for the concern.

Remon

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 13-Feb-2020 14:51:25   

Ah good point simple_smile We'll add it in v5.7

Frans Bouma | Lead developer LLBLGen Pro