public void ByDefaultOnlyOneThreadCanEnter() { int counter = 0; var criticalSection = new AsyncLazy.AsyncLock(); ; var threads = Enumerable.Range(1, 10).Select(n => new Thread(() => criticalSection.Run(() => { counter++; counter.Should().Be(1); counter--; }))).ToList(); threads.ForEach(thread => thread.Start()); threads.ForEach(thread => thread.Join()); counter.Should().Be(0); }