Gauge that gives the user an aggregate of requested counters in a cache.
Inheritance: ICounterValue
        public void TestPerformanceCounterValuesAreCorrectlyRetrievedUsingRawCounterGauge()
        {
            RawCounterGauge gauge = new RawCounterGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", "privateBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests());
            double value = gauge.GetValueAndReset();

            Assert.IsTrue(value > 0);
        }
        public void RateCounterGaugeGetValueAndResetGetsTheValueFromJson()
        {
            SumUpCountersGauge twoTimesPrivateBytes = new SumUpCountersGauge(
                "twoTimesPrivateBytes",
                new RawCounterGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes * 2", "privateBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests()),
                new RawCounterGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", "privateBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests()));

            RawCounterGauge privateBytes = new RawCounterGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", "privateBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests());

            double expectedValue = privateBytes.GetValueAndReset();
            double actualValue = twoTimesPrivateBytes.GetValueAndReset();

            // twoTimesPrivateBytes is -greater than (privateBytes * 1.85) but lower than (privateBytes * 2.15).
            Assert.IsTrue((expectedValue * 1.85) < actualValue && (expectedValue * 2.15) > actualValue);
        }
        public void RateCounterGaugeGetValueAndResetGetsTheValueFromJson()
        {
            RawCounterGauge readIoBytes = new RawCounterGauge("READ IO BYTES", "readIoBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests());
            RawCounterGauge writeIoBytes = new RawCounterGauge("WRITE IO BYTES", "writeIoBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests());
            RawCounterGauge otherIoBytes = new RawCounterGauge("OTHER IO BYTES", "otherIoBytes", AzureWebApEnvironmentVariables.App, new CacheHelperTests());

            RatioCounterGauge readIoBytesRate = new RatioCounterGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", readIoBytes, writeIoBytes);

            double value1 = readIoBytesRate.GetValueAndReset();
            Assert.IsTrue(value1 != 0);

               SumUpCountersGauge writeAndOtherBytes = new SumUpCountersGauge("Sum Up Bytes", writeIoBytes, otherIoBytes);
               RatioCounterGauge totalReadIoBytesRate = new RatioCounterGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", readIoBytes, writeAndOtherBytes);
               double value2 = totalReadIoBytesRate.GetValueAndReset();

            Assert.IsTrue(value2 != 0);
            Assert.IsTrue(value1 >= value2);

               RatioCounterGauge totalReadIoBytesPercentage = new RatioCounterGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", readIoBytes, writeAndOtherBytes, 100);
               double percentage = totalReadIoBytesPercentage.GetValueAndReset();
            Assert.IsTrue(percentage != 0);
            Assert.IsTrue(Math.Abs((value2 * 100) - percentage) < 1);
        }