It's popular, and there's nothing wrong with it per se, but my goal is to use TDD. I can write a test that motivates the non-lock parts of this code, but I don't know how to write a test that demands the locking.class Counter{readonly object _syncRoot = new object();int i = 0;internal int GetValue(){lock (_syncRoot){return i++;}}}
No comments:
Post a Comment