public void TestOnceCallsOnlyOnce() { int value = 0; var once = new Once <int>(() => Interlocked.Increment(ref value)); Parallel.For(0, 1000, _ => { once.EnsureDone(); }); Assert.AreEqual(1, value); }