예제 #1
0
        public void Increments()
        {
            noLabel.Increment();
            Assert.Equal(1, noLabel.Value());

            noLabel.Increment(2);
            Assert.Equal(3, noLabel.Value());

            noLabel.WithLabels().Increment(4);
            Assert.Equal(7, noLabel.Value());

            noLabel.WithLabels().Increment();
            Assert.Equal(8, noLabel.Value());
        }
        public static T TrackInProgress <T>(this IGauge gauge, Func <T> fun)
        {
            gauge.Increment();
            var ret = fun.Invoke();

            gauge.Decrement();

            return(ret);
        }
 public static void TrackInProgress(this IGauge gauge, Action fun)
 {
     gauge.Increment();
     fun.Invoke();
     gauge.Decrement();
 }
예제 #4
0
            /// <summary>
            /// Initializes a new instance of the type
            /// </summary>
            /// <param name="gauge">The gauge to modify</param>
            public Tracker(IGauge gauge)
            {
                _gauge = gauge;

                _gauge.Increment();
            }