This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hey guys! I'm having a problem where I have some test cases that pass when I have my tests setup and CompleteUnitOfWork(false), to roll it back, but then fail when I have CompleteUnitOfWork(true) in my app... The problem is that I have done the mapping wrong and should have the tests failing - however this is not reported by my tests because the CompleteUnitOfWork(false) doesnt actually execute the sql/run down the stack checking all the bits and pieces - it just chucks what it has away (obvious for performance reasons). Have you got any tips of getting around this problem and/or what is the possibility of getting a CompleteUnitOfWork(...) override for use in unit tests? I could probibly wrap my test classes in an outer transaction (havent tried this yet) but just thought I'd ask - Cheers, James |
|
|
Hi James, Passing false to CompleteUnitOfWork is only useful when you don't care about persisting any pending changes. When you do care you can use either SaveChanges (if you have more work to do - i.e. perform a flush) or CompleteUnitOfWork (if you have no more work to do - e.g. the end of a web request). For transactional tests check this post: http://www.mindscape.co.nz/blog/?p=43 Cheers, Andrew. |
|