Ejemplo n.º 1
0
        public void WarewolfRequestsPerSecondPerformanceCounter_IncrementBy_CallsUnderlyingCounter()
        {
            var mockPerformanceCounterFactory = new Mock <IRealPerformanceCounterFactory>();
            var mockCounter = new Mock <IWarewolfPerformanceCounter>();

            mockPerformanceCounterFactory.Setup(o => o.New(GlobalConstants.Warewolf, CounterName, GlobalConstants.GlobalCounterName)).Returns(mockCounter.Object).Verifiable();
            var performanceCounterFactory = mockPerformanceCounterFactory.Object;
            IPerformanceCounter counter   = new WarewolfRequestsPerSecondPerformanceCounter(performanceCounterFactory);

            counter.Setup();
            counter.IncrementBy(1234);

            mockPerformanceCounterFactory.Verify();
            mockCounter.Verify(o => o.IncrementBy(1234), Times.Once);
        }