views:

55

answers:

1

Hello,

I'm writing my own transaction-aware (IEnlistmentNotification) piece of code and am trying to test it using XUnit. All I need is to wait the transaction commited and test the outcome is what I expect. The thing is that transaction commitment happens in a separate thread, so I need to synchronize my test and piece of code I'm testing. Aside of using EventWaitHandle, are there any simpler ways to test something after the transaction completed?

Thanks.

A: 

Sounds like you are trying to test two things in one test; you're testing that a certain thing happens and you are testing that a transaction actually commits. I would definitly try to test them seperatly. I.e. test "functionality" without transactions and then test transactions with fake "functionality". That hopefully makes it easier to test them and may or may not (depending on your design) eliminate the need for "transaction threads".

Cellfish