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
|
Any way to have the test unit of work be able to attach and save changes without actually doing anything to the database? I'm trying to unit test custom logic in my OnSaving override. Thanks! |
|
|
Hi, The issue at the moment with this is that the TestUnitOfWork does not maintain an identity map of impacted entities. You set return values for collections, or for single result set queries. That means that at one time you may have loaded the TestUnitOfWork with a set of entities to be returned for a collection query AND a single entity for, say, a GetById query. We don't know, when calling SaveChanges() which entities we should be triggering the event of OnSaving. Any suggestions are appreciated. John-Daniel |
|
|
Hi JD, Do you have any plans to support some kind of TestUnitOfWork which simulates a (simple) in-memory database? I.e. when you query it, it really does run the query? Perhaps by limiting it to a LINQ query API and then using LINQ-to-Objects to run the queries. John |
|
|
Hi John - long time! We should grab a coffee sometime :-) Anyway, onto your question. We don't have any plans for this at the moment and at present we're gunning for the LightSpeed 5 release. In memory testing became quite popular about 3-4 years back and what often happened was that folks used SQLite with the in memory option enabled to run their tests against. There was the limitation that SQLite doesn't have all the features of the bigger database engines but in terms of 'simple' and 'fast', it did the work. Would that be a possibility for you? -JD |
|
|
Hi JD, Yes, long time indeed. I didn't enjoy a previous attempt to do the SQLLite option - as I recall the problems included those you mention. Ended up rolling my own version of my above suggestion, using LINQ to Objects. Was just hoping to avoid doing it again on my new project ;-) Regards, John |
|