public void counter_add_signal_IsSet_false() { var counterSignal = new CounterSignal(10, 0); counterSignal.Add(9); Assert.IsFalse(counterSignal.IsSet); }
public void counter_add_signal_IsSet_true() { var counterSignal = new CounterSignal(10, 1); counterSignal.Add(100); Assert.IsTrue(counterSignal.IsSet); Assert.IsTrue(counterSignal.Wait(TimeSpan.Zero)); }
public void benchmark_add_value() { var counterSignal = new CounterSignal(1, 0); const int iterations = 10000000; var sw = Stopwatch.StartNew(); for (var i = 0; i < iterations; i++) { counterSignal.Add(1); } sw.Stop(); Assert.Inconclusive("{0} ({1:N0} ops/sec)", sw.Elapsed, (decimal)iterations / sw.ElapsedMilliseconds * 1000m); }