public void SingleSetable_Set_Test() { var singleSetable = new SingleSetable(); Assert.False(singleSetable.Set()); Assert.True(singleSetable.Set()); Assert.True(singleSetable.Set()); }
public void SingleSetable_MultibleCheck_Test() { var sw = new Stopwatch(); var singleSetable = new SingleSetable(); sw.Reset(); sw.Start(); for (var i = 0; i < 10000; i++) { singleSetable.Set(); } sw.Stop(); Console.WriteLine("ElapsedTicks {0}", sw.ElapsedTicks); var singleSetableLock = new SingleSetableLock(); sw.Reset(); sw.Start(); for (var i = 0; i < 10000; i++) { singleSetableLock.Set(); } sw.Stop(); Console.WriteLine("ElapsedTicks {0}", sw.ElapsedTicks); }