Ejemplo n.º 1
0
        public void CurrentValue_decremented_on_Decrement()
        {
            var counterSignal = new CounterSignal(0, 2);

            counterSignal.Decrement();
            Assert.AreEqual(1, counterSignal.CurrentValue);
        }
Ejemplo n.º 2
0
        public void counter_increment_then_decrement_signal_IsSet_false()
        {
            var counterSignal = new CounterSignal(2, 1);

            counterSignal.Increment();
            counterSignal.Decrement();
            Assert.IsFalse(counterSignal.IsSet);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets and removes the object at the beginning of the queue
        /// </summary>
        public T Dequeue(CancellationToken cancellationToken)
        {
            T item;

            do
            {
                _counterSignal.Wait(cancellationToken);
            } while (!_queue.TryDequeue(out item));
            _counterSignal.Decrement();
            return(item);
        }
Ejemplo n.º 4
0
 public void CurrentValue_decremented_on_Decrement()
 {
     var counterSignal = new CounterSignal(0, 2);
     counterSignal.Decrement();
     Assert.AreEqual(1, counterSignal.CurrentValue);
 }
Ejemplo n.º 5
0
 public void counter_increment_then_decrement_signal_IsSet_false()
 {
     var counterSignal = new CounterSignal(2, 1);
     counterSignal.Increment();
     counterSignal.Decrement();
     Assert.IsFalse(counterSignal.IsSet);
 }