Implementing complex unit testing with IoC
I have a method that looks something like this public void DoSomething(SomeClass someInstance, User user) { var persistence = someInstance.AsIObject.GetEcoService<IPersistenceService>(); persistence.Unload(someInstance.AsIObject()); if (someInstance.CurrentUser != null) throw new ..........; someInstance.CurrentUser = user; persistence.UpdateDatabase(someInstance); } This unloads the local cache before ensuring someInstance.CurrentUser == null, it then sets someInstance.CurrentUser and updates the DB. The unit test I wanted would check what happens when two users try to perform this at the same time. What I wanted was User A: Unload User B: Unload User A: Check == null, it is User B: Check == null, it is User A: Change + update DB User B: Change + update DB + experience a lock exception What I didn't want was User A: Unload User B: Unload User A: Check == null, it is User A: Change + update DB User B: Check == null, it isn't To achieve two things runnin